Hi Everyone,
I wanted to provide an update on this. I tried to recreate this test using
only htmlUnit. It turns out that HtmlUnit 2.5 only handles the the dojo
elements in Firefox3.0.
Knowing this I had to change the webtest.xml and add the following property.
<property name="wt.config.browser" value="Firefox3" />
Once the property had been changed; I noticed that unlike HtmlUnit the
setInputField step does not change the text value correctly.
I have shown the clickElement steps to change the Dojo date in Webtest.
Maybe someone knows how to change the field with useing clickElement.
However, if you are having provblems with dojo calander this is a good work
around.
webtest grovvy code:
//sleep seconds: "5"
//setInputField name:"startDate", value:"04/01/2009"
*Java Code for HtmlUnit: *
final HtmlSelect select = ( HtmlSelect )searchForm.getSelectsByName(
"searchBy" ).get( 0 );
select.setSelectedAttribute("type", true);
String lastpage = page.asXml();
ConverToHtml(lastpage);
*
searchForm.getInputByName("startDate").setValueAttribute("04/01/2009");*
//form.getInputByName("password").setValueAttribute("vmanager");
System.out.println(page.asText());
page = (HtmlPage) searchForm.getInputByName("imgsubmit").click();
System.out.println(page.asText());
*
Web-Test grovvy code: *
clickElement xpath:"//i...@alt='Select a date']"
//Start Date
///html/body/table/tbody/tr[5]/td/div/fo...@id='transactionHistoryForm']/tab...@id='batchFormTable']/tbody/t...@id='cal']/td[2]/sp...@id='sdate']/img
sleep seconds: "1"
clickElement xpath:
"/html/body/span/div/table/thead/tr/td/table/tbody/tr/td[2]/span[4]/img"
sleep seconds: "1"
clickElement xpath:
"/html/body/span/div/table/tbody/tr/td/table/tbody/tr[2]/td[4]"
On Thu, May 21, 2009 at 3:48 PM, Vihang Desai <[email protected]> wrote:
> Hi Marc,
>
> it look like setInputField is working but its not finding the field as a
> input field. The error indicates it as an div input. I am not sure how to
> change value of a Div element using web-test.
>
> Please let me know if you have anything at all.
>
> Thank you,
>
>
> Vihang
>
> setInputField htmlId:"sdate", value:"01/01/2009"
>
> <div id="sdate" dojotype="dropdowndatepicker" inputname="startDate"
> inputid="startDate" displayformat="MM/dd/yyyy" value="">
>
> Error Message
>
> Found div when looking for input
>
>
> On Wed, May 20, 2009 at 3:43 AM, Marc Guillemot <[email protected]>wrote:
>
>> Hi Vihang,
>>
>> you can't use JS to identify nodes but the xpath or the htmlId attribute
>> of setInputField should work fine.
>>
>> Cheers,
>> Marc.
>> --
>> Web: http://www.efficient-webtesting.com
>> Blog: http://mguillem.wordpress.com
>>
>> Vihang Desai wrote:
>> > Hi Marc,
>> >
>> > It looks like you are right it is a dynamically generated filed at run
>> > time. When I executed the following step; webtest printed the same
>> > output I see from Firefox (firebug). However, I am assuming the next for
>> > me it to find out the xpath and try to creat click events for the date?
>> >
>> > Is there a way I can input JavaScript at run time into my test to change
>> > this fields?
>> >
>> > Maybe Document.getElementbyID?
>> >
>> >
>> > groovy {
>> > println step.context.currentResponse.asXml()
>> > }
>> >
>> > I am not sure how to handel
>> >
>> >
>> > <table id="batchFormTable" class="centered">
>> > [groovy] <tbody>
>> > [groovy] <tr id="cal" style="{display: none};">
>> > [groovy] <td class="input-label">
>> > [groovy] Start date
>> > [groovy] </td>
>> > [groovy] <td>
>> > [groovy] <div id="sdate"
>> > dojotype="dropdowndatepicker
>> > " inputname="startDate" inputid="startDate" displayformat="MM/dd/yyyy"
>> > value="">
>> >
>> > [groovy] </div>
>> > [groovy] </td>
>> > [groovy] <td class="input-label" align="left">
>> > [groovy] End dateĆ”
>> > [groovy]
>> > [groovy] <div id="edate"
>> > dojotype="dropdowndatepicker
>> > " inputname="endDate" inputid="endDate" displayformat="MM/dd/yyyy"
>> value="">
>> > [groovy] </div>
>> > [groovy] </td>
>> > [groovy] </tr>
>> > [groovy] <tr>
>> > [
>> >
>> > On Wed, May 6, 2009 at 3:08 AM, Marc Guillemot <[email protected]
>> > <mailto:[email protected]>> wrote:
>> >
>> > Hi,
>> >
>> > is the input field generated dynamically? Can you dump the page to
>> the
>> > console see the current state of the DOM:
>> >
>> > <groovy>
>> > println step.context.currentResponse.asXml()
>> > </groovy>
>> >
>> > Cheers,
>> > Marc.
>> > --
>> > Web: http://www.efficient-webtesting.com
>> > Blog: http://mguillem.wordpress.com
>> >
>> > Vihang Desai wrote:
>> > > Hi Marc,
>> > >
>> > > When I try the setInputField name:"startDate", value:"01/01/2009"
>> in
>> > > Cannoo WebTest; the field is not found.
>> > >
>> > > I am getting the error message "No suitable form found having
>> field
>> > > named "startData". The dojo Calendar field is not recognized by
>> > > htmlUnit. In the resulting page I am not able to see the field at
>> all.
>> > >
>> > > I am trying to find out if there is code out there for htmlUnit to
>> > > recognize the dojo Calendar filed on my website.
>> > >
>> > > Please let me know if you have any thing at all.
>> > >
>> > > All help is welcome because I really like WebTest as testing and
>> > > reporting tool.
>> > >
>> > >
>> > > Thank you,
>> > >
>> > >
>> > > Vihang Desai
>> > >
>> > >
>> > >
>> > > On Wed, Apr 29, 2009 at 3:56 AM, Marc Guillemot
>> > <[email protected] <mailto:[email protected]>
>> > > <mailto:[email protected] <mailto:[email protected]>>> wrote:
>> > >
>> > > Hi Vihang,
>> > >
>> > > what doesn't work exactly?
>> > >
>> > > Cheers,
>> > > Marc.
>> > > --
>> > > Web: http://www.efficient-webtesting.com
>> > > Blog: http://mguillem.wordpress.com
>> > >
>> > > Vihang Desai wrote:
>> > > > Hi Everyone,
>> > > >
>> > > > In one of my test I am trying to change the date for a dojo
>> > calendar
>> > > > widegit. However, my setInputField function below is not
>> > working.
>> > > >
>> > > > Can anyone provide me with a example of changing a dojo
>> > Calendar text
>> > > > field in WebTest?
>> > > >
>> > > > setInputField name:"startDate", value:"01/01/2009"
>> > > >
>> > > >
>> > > > Please advise...
>> > > >
>> > > > Thank you,
>> > > >
>> > > >
>> > > > --
>> > > > __________________________
>> > > > Vihang Desai
>> > > > Test Engineer (U.S. Citizen)
>> > >
>> > > _______________________________________________
>> > > WebTest mailing list
>> > > [email protected] <mailto:[email protected]>
>> > <mailto:[email protected] <mailto:[email protected]>>
>> > > http://lists.canoo.com/mailman/listinfo/webtest
>> > >
>> > >
>> > >
>> > >
>> > > --
>> > > __________________________
>> > > Vihang Desai
>> > > Test Engineer (U.S. Citizen)
>> >
>> > _______________________________________________
>> > WebTest mailing list
>> > [email protected] <mailto:[email protected]>
>> > http://lists.canoo.com/mailman/listinfo/webtest
>> >
>> >
>> >
>> >
>> > --
>> > __________________________
>> > Vihang Desai
>> > Test Engineer (U.S. Citizen)
>>
>> _______________________________________________
>> WebTest mailing list
>> [email protected]
>> http://lists.canoo.com/mailman/listinfo/webtest
>>
>
>
>
> --
> __________________________
> Vihang Desai
> Test Engineer (U.S. Citizen)
>
--
__________________________
Vihang Desai
Test Engineer (U.S. Citizen)