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