[Webtest] Form fields not found

Marc Guillemot Marc Guillemot <mguillemot@yahoo.fr>
Tue, 09 Sep 2008 13:00:17 +0200


how is the form created? Just made visible or is it the result of some
serve call? Do you see the form in the result page available after
you've clicked the button?

Sorry, but I don't understand what you mean with "double-posted" in Firefox.

Blog: http://mguillem.wordpress.com

av8r wrote:
> Hi,
> I am trying to automate the testing of our application using webtest, but it
> fails for
> something we call subpanels in our application. I am able to click on the
> button "Create"
> to bring up the form, which in the real application will show the form which
> contains
> few html form fields. I am using htmlunit-2.2 and still experiencing the
> problem. Read
> in some other threads that this should be resolved in htmlunit-2.2
> Canoo webtest recorder is able to pick up the form field but when I use it
> in my script,
> it is not able to find it. I believe the form itself is generated by some
> javascript coding or
> something.
> The basic test is as below:
> <project default="test">
>    <target name="test">
>        <webtest name="Test 1 - Create, Search, Delete Contact">
>             <steps>
>                 <echo message="Execute login and step"/>
>                 &loginAndStep;
>                 <clickLink label="Accounts"/>
>                 <clickLink label="Create Account"/>
>                 <setInputField htmlId="name" value="Test Account"/>
>                 <clickButton label="Save" name="button"/>
>                 <selectForm name="form" id="formformContacts"/>
>                 <clickButton name="accounts_contacts_create_button"/>
>                 <selectForm name="form" id="QuickCreate"/>
>                 <clickButton name="Contacts_subpanel_full_form_button"/>
>                 <setInputField htmlId="first_name" value="Joe"/>    <===
> This is where it fails
>                 <setInputField name="last_name" value="Hartman"/>
>                 <clickButton label="Save"/>
> I have added couple of screenshots of how it looks before and after the
> "account_contacts_create_button" is clicked which opens up the form. I tried
> this on Firebug
> with Mozilla. Originally, it fails to show the html fields in the form,
> complains that the form needs to
> be double-posted. Once I click on the Load button for that, it does show
> these html form fields.
> My question is: How can I force webtest to run post when I want it to,
> rather than after clicking on
> some button? Also, if this is not the issue what could be causing it?
> I would really appreciate if someone can help me resolve this. Its the
> gating factor in my automation
> efforts here, and I am pulling my hair out over this. Please help.
> http://www.nabble.com/file/p19284212/before.JPG before.JPG 
> http://www.nabble.com/file/p19284212/after.JPG after.JPG