[Webtest] Webtest and AJAX

Soula, William Soula, William" <wsoula@pointserve.com
Wed, 10 Sep 2008 06:52:33 -0500


verifyText just does a search through the source.  If you go to your ajax p=
age and do a view source can you do a search through that and find the stri=
ng you want?  If not then your problem is similar to one I've run across; t=
hat since verifyText works against the source it won't find ajax loaded con=
tent.  I have inserted a sleep to wait for ajax to load then use verifyXPat=
h to verify whatever text is on the page that I want to verify.

-----Original Message-----
From: webtest-admin@lists.canoo.com [mailto:webtest-admin@lists.canoo.com] =
On Behalf Of av8r
Sent: Tuesday, September 09, 2008 6:25 PM
To: webtest@lists.canoo.com
Subject: [Webtest] Webtest and AJAX


Hi,

I am having problems with the webtest and ajax. We are using XMLHttpRequest=
 with responses coming back as responseText. However, it does not seem to b=
e working.
Everything seems to be going fine except when I get to the verifyText step.
The text
is missing, and instead the default text gets saved. Seems like the AJAX st=
uff is not working even though all the steps till the verifyText all get ex=
ecuted correctly. I am on build 1716 and using htmlunit-2.2.

<config easyajax=3D"true"/>
   <steps>
       <property name=3D"first_name" value=3D"Eddie"/>
       <property name=3D"last_name" value=3D"Nettleton"/>
       &loginAndStep;

       <echo message=3D"Schedule a call"/>
       <clickLink label=3D"Calendar"/>
       <clickLink label=3D"Schedule Call"/>
       <setInputField name=3D"name" value=3D"Call China office"/>
       <setSelectField name=3D"duration_minutes" text=3D"45"/>
       <setSelectField htmlid=3D"parent_type" text=3D"Case"/>
       <setSelectField htmlid=3D"parent_type" text=3D"Contact"/>

        <!-- Trying to figure out AJAX stuff here -->
        <selectForm name=3D"EditView" />
        <clickElement htmlId=3D"parent_name"/> <!-- Focus on the textbox --=
>
        <sleep seconds=3D"5"/> <!-- Wait for AJAX response -->
        <setInputField htmlId=3D"parent_name" value=3D"${first_name} ${last=
_name}"/> <-- Search & set name-->

        <clickButton description=3D"Now click on Save" label=3D"Save"/>
        <verifyText description=3D"Check if page has related to stuff"
text=3D"${first_name}> <!-- FAILS HERE -->
        <clickLink label=3D"Logout"/>
   </steps>
--
View this message in context: http://www.nabble.com/Webtest-and-AJAX-tp1940=
3354p19403354.html
Sent from the WebTest mailing list archive at Nabble.com.

_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest