Hi Marc, as requested, I'm posting the following to the group.... I'm
having trouble getting setselectfield to wait for the ajax response to
come back. If you look at the code below in between getting the first
sku option and the second, the page is in a transient state where its
waiting for the ajax response for the second sku option but the webtest
wants to set the field before it is even available. I've tried
everything under the sun, from 'retry', to adding 'sleep', to setting
'easyajax to true', I have the latest webtest (build
webtest-releases3.0-1758). The funny thing is, this test, when
expressed as groovy does work when I used 'retry' for the second
setselectfield which is visible after an ajax call, but for the life of
me could not get the dataDriven ant task to work, so I switched to the
webtest being expressed in xml and the dataDriven task now works but now
I have this ajax problem!
Any help would be appreciated!
thanks Marc!
SimpleTest.xml:
<project name="SimpleTest" default="wt.testInWork">
<target name="wt.testInWork">
<dataDriven tableContainer="MultipleSkuOptionsAddToCartTest.xls">
<webtest name="my simple Test">
<config easyajax="true"/>
<config>
<option
name="ThrowExceptionOnScriptError"
value="false"/>
</config>
<steps>
<invoke url="http://${hostname}" description="Get Home Page"/>
<echo message="HOSTNAME IS ${hostname}"/>
<echo message="datadriven_resources is ${datadriven_resources}"/>
<!--<echo message="HELLO ${search_sku}"/>-->
<setInputField
name="search_string"
value="${search_sku}">
</setInputField>
<clickButton label="Search"/>
<sleep seconds="3"/>
<setSelectField
description="1st Sku option"
htmlId="skuOpt0"
text="${sku_option0}"/>
<sleep seconds="2"/>
<!--<enableJavaScript enable="false" />-->
<retry maxcount="4">
<setSelectField
formName="addToCart"
description="2nd Sku option"
name="skuOption_1"
text="${sku_option1}"/>
</retry>
<clickButton label="add To Cart button"/>
<sleep seconds="2"/>
<!--use this response to revert back to the old html before the 'Add To
Cart' Ajax action was called -->
<previousResponse/>
<clickLink description="Click link: Proceed to Checkout"
htmlId="affirmativeShoppingCartLink"/>
<echo message="resultant sku is ${resultant_sku}"/>
<verifyXPath
description="verifying text on the screen"
text="SKU ${resultant_sku}"
xpath="/html/body/div/table/tbody/tr[2]/td/table/tbody/tr[2]/td/div/div/div[3]/form/ul[2]/li[1]/div[2]/p[1]">
</verifyXPath>
</steps>
</webtest>
</dataDriven>
</target>
</project>