[Webtest] New XPath

Soula, William Soula, William" <wsoula@pointserve.com
Tue, 8 Jul 2008 12:42:00 -0500


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

I have been trying to upgrade to the latest version of webtest and xpath ha=
s been giving me much trouble.  I think I have got it down to this problem:

<verifyXPath xpath=3D"wt:cleanText(//tr[td=3D'WATIR'])"/> -> Works
<verifyXPath xpath=3D"//tr[wt:cleanText(td)=3D'WATIR']"/> -> Doesn't Work

Why are these two xpaths evaluating differently?  The reason I want to know=
 is that I'm trying to verify the preceding sibling checkbox is checked and=
 I can't wrap the whole xpath in wt:cleanText, because "The xpath doesn't s=
elect an Element: 'class java.lang.String'".  Source code below:

<html>
<head>
  <title>Planning</title>
</head>
    <table id=3D"resourceSelectionTable" class=3D"data">
       <tr>
      <td><input type=3D"checkbox" name=3D"selectedResources" value=3D'1' o=
nClick=3D"resourceCheckboxEventHandler()" checked></td>
           <td>WATIR</td>
       </tr>
    </table>
</body>
</html>

--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB1844F45732SGPEXCHANGEpo_
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.16674" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D905291117-08072008><FONT face=3DArial size=3D2>I have be=
en trying=20
to upgrade to the latest version of webtest and xpath has been giving me mu=
ch=20
trouble.&nbsp; I think I have got it down to this problem:</FONT></SPAN></D=
IV>
<DIV><SPAN class=3D905291117-08072008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D905291117-08072008><FONT face=3DArial size=3D2>&lt;verif=
yXPath=20
xpath=3D"wt:cleanText(//tr[td=3D'WATIR'])"/&gt; -&gt; Works<BR>&lt;verifyXP=
ath=20
xpath=3D"//tr[wt:cleanText(td)=3D'WATIR']"/&gt;&nbsp;-&gt; Doesn't=20
Work</FONT></SPAN></DIV>
<DIV><SPAN class=3D905291117-08072008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D905291117-08072008><FONT face=3DArial size=3D2>Why are t=
hese two=20
xpaths evaluating differently?&nbsp; The reason I want to know is that I'm=
=20
trying to verify the preceding sibling checkbox is checked and I can't wrap=
 the=20
whole xpath in wt:cleanText, because "<FONT face=3D"Times New Roman" size=
=3D3>The=20
xpath doesn't select an Element: 'class java.lang.String'"</FONT>.&nbsp; So=
urce=20
code below:</FONT></SPAN></DIV>
<DIV><SPAN class=3D905291117-08072008><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D905291117-08072008><FONT face=3DArial=20
size=3D2>&lt;html&gt;<BR>&lt;head&gt;<BR>&nbsp;=20
&lt;title&gt;Planning&lt;/title&gt;<BR>&lt;/head&gt;<BR>&nbsp;&nbsp;&nbsp;&=
nbsp;&lt;table=20
id=3D"resourceSelectionTable"=20
class=3D"data"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;tr&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;&lt;input=20
type=3D"checkbox" name=3D"selectedResources" value=3D'1'=20
onClick=3D"resourceCheckboxEventHandler()"=20
checked&gt;&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;=20
&nbsp;&lt;td&gt;WATIR&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/tr&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/table&gt;<BR>&lt;/body&gt;<BR>&=
lt;/html&gt;</FONT></SPAN></DIV></BODY></HTML>

--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB1844F45732SGPEXCHANGEpo_--