Marc would be best to answer this but it is possibly not a bug.  verifyText 
works against the source of the page, at least for my ajax pages when I do a 
view source on the page I do not see what is loaded by ajax just the code 
calling the ajax that will load the content.  I wrote this note to answer 
someone else's same problem and perhaps it is less confusing than my simple 
explanation above:
http://markmail.org/search/?q=ajax+verifytext#query:ajax%20verifytext%20list%3Acom.canoo.lists.webtest+page:1+mid:ry6bafe5qsgxo7fv+state:results


From: Michal Sokolowski [mailto:mic...@gradweb.co.uk]
Sent: Friday, February 20, 2009 7:41 AM
To: webtest@lists.canoo.com; Soula, William
Subject: RE: verifyText problem

This is the problem because I need this to be as simple as possible. Basically 
I've wrote asp.NET harness around WebTest, so even non technical users should 
be able to record and run simple tests using WebTest recording tool.
If veryfiText is really not working after ajax reload, shouldn't it be raised 
as a bug?

Thanks very much.

Kind regards,

Michal Sokolowski
Web Developer
________________________________
From: webtest-ad...@lists.canoo.com [mailto:webtest-ad...@lists.canoo.com] On 
Behalf Of Soula, William
Sent: Friday 20 February 2009 13:11
To: webtest@lists.canoo.com
Subject: [Webtest] RE: verifyText problem

Try using XPath I have found verifyText to not work after an ajax reload.

From: webtest-ad...@lists.canoo.com [mailto:webtest-ad...@lists.canoo.com] On 
Behalf Of Michal Sokolowski
Sent: Friday, February 20, 2009 5:51 AM
To: webtest@lists.canoo.com
Subject: [Webtest] verifyText problem

Hi All,

Thank you for the help with my previous problem, but unfortunately I've run 
into another one.
I'm trying to verify if the item has been added to list, but unfortunately 
webtest is always failing to find the text. Weird thing is when I'm looking on 
the results page on the step that errors I can clearly see the text I'm looking 
for. I've looked into the list archive but none of the solutions are working 
for me.
The text I'm looking for is appearing on the page after ajax reload.

Here is the test XML:
<project default="test">
  <target name="test">
    <webtest name="Check if List Exist">
      <config>
        <header name="User-Agent" value="Mozilla/5.0 (Windows; U; Windows NT 
5.1; de; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12" />
        <option name="ThrowExceptionOnScriptError" value="false" />
      </config>
      <invoke 
url="http://gradwebuat01:1999/Login.aspx?ReturnUrl=%2fadmin%2fPages%2fgloballistview.aspx";
 />
      <sleep description="it is typically wise to include a sleep" seconds="5" 
/>
      <setInputField name="ctl00$cphBody$Login1$UserName" value="admin" />
      <sleep description="it is typically wise to include a sleep" seconds="5" 
/>
      <setInputField description="Set password field 
ctl00$cphBody$Login1$Password: admin" name="ctl00$cphBody$Login1$Password" 
value="admin" />
      <sleep description="it is typically wise to include a sleep" seconds="5" 
/>
      <clickButton label="Log In" />
      <sleep description="it is typically wise to include a sleep" seconds="5" 
/>
      <setSelectField name="ctl00$cphAdmin$ddlIntakes" text="Test Intake 1" />  
<-- Here ajax reload occurs
      <sleep description="it is typically wise to include a sleep" seconds="5" 
/>
      <verifyText description="Verify that text is contained in the page" 
text="TestGL " />
      <sleep description="it is typically wise to include a sleep" seconds="5" 
/>
    </webtest>
  </target>
</project>

And the part of HTML code that I'm getting from Webtest report on failed step.

<tr class="gridViewAltRowStyle">

                          <td>

                            TestGL

                          </td>

                          <td class="gridViewButtonRowField" align="center">

                            <a 
href="GlobalListEdit.aspx?id=1956daee-5d4c-4ca6-8ee1-ed956f0f24a3" title="Press 
this link to edit the global list">



                                    Edit



                            </a>

                          </td>

                          <td class="gridViewButtonRowField" align="center">

                            <a onclick="return confirm(&apos;Are you sure you 
wish to delete this record?&apos;);" 
id="ctl00_cphAdmin_gvwGlobalLists_ctl17_btnDelete" title="Click me..." 
href="javascript:__doPostBack(&apos;ctl00$cphAdmin$gvwGlobalLists$ctl17$btnDelete&apos;,&apos;&apos;)">

                              Delete

                            </a>

                          </td>

                          <td class="gridViewButtonRowField" align="center">

                            <a 
id="ctl00_cphAdmin_gvwGlobalLists_ctl17_btnCopyList" 
href="javascript:__doPostBack(&apos;ctl00$cphAdmin$gvwGlobalLists$ctl17$btnCopyList&apos;,&apos;&apos;)">

                              Copy

                            </a>

                          </td>

                        </tr>

Any ideas?

Kind regards,

Michal Sokolowski
Web Developer

Reply via email to