Hi,

On Thu, Oct 08, 2009 at 02:44:55PM -0500, Soula, William wrote:
> Is it possible this stuff is created using ajax for you guys?  If so
> you can use a sleep to wait for it to load and then check it with
> xpath.

Instead of sleeping a certain time you can do the check in a loop and
sleep one second only. That saves you time if your request is a lot
shorter that the aproximated 5 seconds and also if a request hangs once
you wont get a failure.

I use this macro to check for an xpath that must be exist after the
response from an ajax call was reveived:

<macrodef name="checkAjaxResponseXpathRegex" description="check
response of an ajax request">
    <attribute name="description" />
    <attribute name="xpath" />
    <attribute name="regex" />
    <sequential>
        <retry maxcount="10">
            <sleep seconds="1"/>
            <verifyXPath
              description="@{description}"
              xpath="@{xpath}"
              regex="@{regex}"
            />  
        </retry>
    </sequential>   
</macrodef>

Inside the webtest I do this:

<setSelectField
  description="Select some value"
  xpath="//sele...@id='some_id']"
  value="some_val"
/>
<checkAjaxResponseXpathText
  description="check result after ajax call"
  xpath="//d...@id='some_id']/ol/li[4]/a"
  text="Sometext"
/>  

With this mechanism I can test most of the Ajax stuff inside a page
that changes the DOM tree when the response is received.

Best regards, Stephan
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to