[Webtest] Webtest and AJAX

Soula, William Soula, William" <wsoula@pointserve.com
Wed, 10 Sep 2008 12:05:19 -0500


--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB18451F2838SGPEXCHANGEpo_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

You can use xpather to find xpaths (it is a firefox extension) although I g=
enerally don't like them as they are absolute xpaths instead of relative, w=
hich is more robust.  I got most of my XPath knowledge from this site: http=
://www.w3schools.com/xpath/default.asp  XPath is very powerful and has gott=
en me out of a lot of situations.

________________________________
From: Harman Birdi [mailto:harman.birdi@gmail.com]
Sent: Wednesday, September 10, 2008 10:20 AM
To: Soula, William
Subject: Re: [Webtest] Webtest and AJAX

William - Thanks for the tip. I am not familiar with XPath. How can I deter=
mine the it?
I know WTR has XPath but I dont know how to use it.
On Wed, Sep 10, 2008 at 4:52 AM, Soula, William <wsoula@pointserve.com<mail=
to:wsoula@pointserve.com>> wrote:
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> [=
mailto: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<mailto: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<mailto:WebTest@lists.canoo.com>
http://lists.canoo.com/mailman/listinfo/webtest
_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com<mailto:WebTest@lists.canoo.com>
http://lists.canoo.com/mailman/listinfo/webtest


--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB18451F2838SGPEXCHANGEpo_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.6000.16705" name=3DGENERATOR></HEAD>
<BODY>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D225450217-10092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2>You can use xpather to find xpaths (it is a firefo=
x=20
extension) although I generally don't like them as they are absolute xpaths=
=20
instead of relative, which is more robust.&nbsp; I got most of my XPath=20
knowledge from this site: <A=20
href=3D"http://www.w3schools.com/xpath/default.asp">http://www.w3schools.co=
m/xpath/default.asp</A>&nbsp;=20
XPath is very powerful and has gotten me out of a lot of=20
situations.</FONT></SPAN></DIV><BR>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> Harman Birdi=20
[mailto:harman.birdi@gmail.com] <BR><B>Sent:</B> Wednesday, September 10, 2=
008=20
10:20 AM<BR><B>To:</B> Soula, William<BR><B>Subject:</B> Re: [Webtest] Webt=
est=20
and AJAX<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=3Dltr>
<DIV>William - Thanks for the tip. I am not familiar with XPath. How can I=
=20
determine the it?</DIV>
<DIV>I know WTR has XPath but I dont know how to use it.<BR></DIV>
<DIV class=3Dgmail_quote>On Wed, Sep 10, 2008 at 4:52 AM, Soula, William <S=
PAN=20
dir=3Dltr>&lt;<A=20
href=3D"mailto:wsoula@pointserve.com">wsoula@pointserve.com</A>&gt;</SPAN>=
=20
wrote:<BR>
<BLOCKQUOTE class=3Dgmail_quote=20
style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1p=
x solid">verifyText=20
  just does a search through the source. &nbsp;If you go to your ajax page =
and=20
  do a view source can you do a search through that and find the string you=
=20
  want? &nbsp;If not then your problem is similar to one I've run across; t=
hat=20
  since verifyText works against the source it won't find ajax loaded conte=
nt.=20
  &nbsp;I have inserted a sleep to wait for ajax to load then use verifyXPa=
th to=20
  verify whatever text is on the page that I want to verify.<BR>
  <DIV>
  <DIV></DIV>
  <DIV class=3DWj3C7c><BR>-----Original Message-----<BR>From: <A=20
  href=3D"mailto:webtest-admin@lists.canoo.com">webtest-admin@lists.canoo.c=
om</A>=20
  [mailto:<A=20
  href=3D"mailto:webtest-admin@lists.canoo.com">webtest-admin@lists.canoo.c=
om</A>]=20
  On Behalf Of av8r<BR>Sent: Tuesday, September 09, 2008 6:25 PM<BR>To: <A=
=20
  href=3D"mailto:webtest@lists.canoo.com">webtest@lists.canoo.com</A><BR>Su=
bject:=20
  [Webtest] Webtest and AJAX<BR><BR><BR>Hi,<BR><BR>I am having problems wit=
h the=20
  webtest and ajax. We are using XMLHttpRequest with responses coming back =
as=20
  responseText. However, it does not seem to be working.<BR>Everything seem=
s to=20
  be going fine except when I get to the verifyText step.<BR>The text<BR>is=
=20
  missing, and instead the default text gets saved. Seems like the AJAX stu=
ff is=20
  not working even though all the steps till the verifyText all get execute=
d=20
  correctly. I am on build 1716 and using htmlunit-2.2.<BR><BR>&lt;config=20
  easyajax=3D"true"/&gt;<BR>&nbsp; &lt;steps&gt;<BR>&nbsp; &nbsp; &nbsp;=20
  &lt;property name=3D"first_name" value=3D"Eddie"/&gt;<BR>&nbsp; &nbsp; &n=
bsp;=20
  &lt;property name=3D"last_name" value=3D"Nettleton"/&gt;<BR>&nbsp; &nbsp;=
 &nbsp;=20
  &amp;loginAndStep;<BR><BR>&nbsp; &nbsp; &nbsp; &lt;echo message=3D"Schedu=
le a=20
  call"/&gt;<BR>&nbsp; &nbsp; &nbsp; &lt;clickLink=20
  label=3D"Calendar"/&gt;<BR>&nbsp; &nbsp; &nbsp; &lt;clickLink label=3D"Sc=
hedule=20
  Call"/&gt;<BR>&nbsp; &nbsp; &nbsp; &lt;setInputField name=3D"name" value=
=3D"Call=20
  China office"/&gt;<BR>&nbsp; &nbsp; &nbsp; &lt;setSelectField=20
  name=3D"duration_minutes" text=3D"45"/&gt;<BR>&nbsp; &nbsp; &nbsp;=20
  &lt;setSelectField htmlid=3D"parent_type" text=3D"Case"/&gt;<BR>&nbsp; &n=
bsp;=20
  &nbsp; &lt;setSelectField htmlid=3D"parent_type"=20
  text=3D"Contact"/&gt;<BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;&lt;!-- Trying to=
 figure=20
  out AJAX stuff here --&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp;&lt;selectForm=20
  name=3D"EditView" /&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp;&lt;clickElement=20
  htmlId=3D"parent_name"/&gt; &lt;!-- Focus on the textbox --&gt;<BR>&nbsp;=
 &nbsp;=20
  &nbsp; &nbsp;&lt;sleep seconds=3D"5"/&gt; &lt;!-- Wait for AJAX response=
=20
  --&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp;&lt;setInputField htmlId=3D"parent_n=
ame"=20
  value=3D"${first_name} ${last_name}"/&gt; &lt;-- Search &amp; set=20
  name--&gt;<BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;&lt;clickButton description=
=3D"Now=20
  click on Save" label=3D"Save"/&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp;&lt;veri=
fyText=20
  description=3D"Check if page has related to stuff"<BR>text=3D"${first_nam=
e}&gt;=20
  &lt;!-- FAILS HERE --&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp;&lt;clickLink=20
  label=3D"Logout"/&gt;<BR>&nbsp; &lt;/steps&gt;<BR>--<BR>View this message=
 in=20
  context: <A=20
  href=3D"http://www.nabble.com/Webtest-and-AJAX-tp19403354p19403354.html"=
=20
  target=3D_blank>http://www.nabble.com/Webtest-and-AJAX-tp19403354p1940335=
4.html</A><BR>Sent=20
  from the WebTest mailing list archive at=20
  Nabble.com.<BR><BR>_______________________________________________<BR>Web=
Test=20
  mailing list<BR><A=20
  href=3D"mailto:WebTest@lists.canoo.com">WebTest@lists.canoo.com</A><BR><A=
=20
  href=3D"http://lists.canoo.com/mailman/listinfo/webtest"=20
  target=3D_blank>http://lists.canoo.com/mailman/listinfo/webtest</A><BR>__=
_____________________________________________<BR>WebTest=20
  mailing list<BR><A=20
  href=3D"mailto:WebTest@lists.canoo.com">WebTest@lists.canoo.com</A><BR><A=
=20
  href=3D"http://lists.canoo.com/mailman/listinfo/webtest"=20
  target=3D_blank>http://lists.canoo.com/mailman/listinfo/webtest</A><BR></=
DIV></DIV></BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>

--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB18451F2838SGPEXCHANGEpo_--