[Webtest] invoke/verifyxpath no elements issue

Dierk König Dierk König
Fri, 11 Apr 2008 15:51:54 +0200 (CEST)


This is a multi-part message in MIME format.

------=_NextPart_000_0191_01C89BEB.F7EFD910
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi Chris,

well, your page would profit from cleaning the html a little ;-)

Anyway, try this:

//ul[@id='clanvideolist']/div[1]//ul[@id='clanvideo']/li[@class='videotext
']//a

i.e.
from the unordered video list
 take the first div below (that indicates the 'row' in your design)
   find the ul for the video 
     with li videotext (to filter away other anchor elements)
       and finally locate the nested anchor 

happy testing
Dierk
 

| -----Original Message-----
| From: webtest-admin@lists.canoo.com 
| [mailto:webtest-admin@lists.canoo.com] On Behalf Of Chris Perelstein
| Sent: Donnerstag, 10. April 2008 19:04
| To: webtest@gate4.canoo.com
| Subject: Re: [Webtest] invoke/verifyxpath no elements issue
| 
| Well, as a more targeted example, I can use the xpath 
| "//div[1]/li//li[1]/a[1]" to target the element I want.  This 
| evaluates exactly how I'd expect when using webtest recorder, 
| so I assume that my xpath is proper (syntactically at least). 
|  But this very same xpath results in a failure in webtest.  I 
| can go to the saved page linked in the webtest report and the 
| xpath works in both xpather and the xpath tool in webtest 
| recorder.  Even the simplest of xpaths, such as "//a" or 
| //div" fail in webtest but not in xpather or the xpath tool 
| in webtest recorder.  After putting the page through 
| htmltidy, it was a little closer to valid, though I still got 
| the same behavior with valid xpaths failing in webtest.  
| Could valid xpaths failing in webtest be the result of 
| non-compliant html?
| 
| 

------=_NextPart_000_0191_01C89BEB.F7EFD910
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.5.7036.0">
<TITLE>RE: [Webtest] invoke/verifyxpath no elements issue</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=3D2>Hi Chris,<BR>
<BR>
well, your page would profit from cleaning the html a little ;-)<BR>
<BR>
Anyway, try this:<BR>
<BR>
//ul[@id=3D'clanvideolist']/div[1]//ul[@id=3D'clanvideo']/li[@class=3D'vi=
deotext']//a<BR>
<BR>
i.e.<BR>
from the unordered video list<BR>
&nbsp;take the first div below (that indicates the 'row' in your =
design)<BR>
&nbsp;&nbsp; find the ul for the video<BR>
&nbsp;&nbsp;&nbsp;&nbsp; with li videotext (to filter away other anchor =
elements)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and finally locate the nested =
anchor<BR>
<BR>
happy testing<BR>
Dierk<BR>
<BR>
<BR>
| -----Original Message-----<BR>
| From: webtest-admin@lists.canoo.com<BR>
| [<A =
HREF=3D"mailto:webtest-admin@lists.canoo.com">mailto:webtest-admin@lists.=
canoo.com</A>] On Behalf Of Chris Perelstein<BR>
| Sent: Donnerstag, 10. April 2008 19:04<BR>
| To: webtest@gate4.canoo.com<BR>
| Subject: Re: [Webtest] invoke/verifyxpath no elements issue<BR>
|<BR>
| Well, as a more targeted example, I can use the xpath<BR>
| &quot;//div[1]/li//li[1]/a[1]&quot; to target the element I =
want.&nbsp; This<BR>
| evaluates exactly how I'd expect when using webtest recorder,<BR>
| so I assume that my xpath is proper (syntactically at least).<BR>
|&nbsp; But this very same xpath results in a failure in webtest.&nbsp; =
I<BR>
| can go to the saved page linked in the webtest report and the<BR>
| xpath works in both xpather and the xpath tool in webtest<BR>
| recorder.&nbsp; Even the simplest of xpaths, such as &quot;//a&quot; =
or<BR>
| //div&quot; fail in webtest but not in xpather or the xpath tool<BR>
| in webtest recorder.&nbsp; After putting the page through<BR>
| htmltidy, it was a little closer to valid, though I still got<BR>
| the same behavior with valid xpaths failing in webtest.&nbsp;<BR>
| Could valid xpaths failing in webtest be the result of<BR>
| non-compliant html?<BR>
|<BR>
| </FONT>
</P>

</BODY>
</HTML>
------=_NextPart_000_0191_01C89BEB.F7EFD910--