[Webtest] RE: XPath: Absolut element location versus conditional branch (new in English)

Ammann Kuno webtest@lists.canoo.com
Thu, 28 Nov 2002 16:35:12 +0100


thanks daniel, your help regarding content selection and matching versus
searching in regex resp. verifyxpath was exactly the bits i missed.

so testing my data table finally worked as expected.
for helping others in the futher i'm submitting my example again. the
table looks like this:
<HTML><HEAD><TITLE>PFFireForm</TITLE>
</HEAD><BODY BGCOLOR=3D3D"#FFFFFF">
<table border=3D3D"0" width=3D3D"80%">
....
</table>
<table id=3D3Ddata>
<tr>
<td>C003</td>
<td>C004</td>
<td>C007</td>
<td>C008</td>
<td>C009</td>
....
</tr>
<tr>
<td>001</td>
<td>CH</td>
<td>CHF</td>
<td></td>
<td>|CHF|ASIA|equity|CS_GROUP_N</td>
....
</tr>
<tr>
....
</tr>
<tr>
....
</tr>
<tr>
<td>001</td>
<td>CH</td>
<td>EUR</td>
<td></td>
<td>CH365|EUR|ASIA|bond|DAILY365</td>=3D20
....
</tr>
</table>
</body>
</html>

and the following test steps worked and returned BUILD SUCCESSFUL:
<verifytext stepid=3D"check ccy via table" text=3D"EUR">
	<table id=3D"data" row=3D"4" column=3D"1"/>
</verifytext>
<verifyxpath stepid=3D"check report table" xpath=3D"/html/body/table[2]"
regex=3D"false"/>
<verifyxpath stepid=3D"check 2" xpath=3D"/html/body/table[2]/tr[2]"
text=3D".*ASIA.*" regex=3D"true"/>
<verifyxpath stepid=3D"check 3" =
xpath=3D"/html/body/table[2]/tr[5]/td[2]"
text=3D"EUR" regex=3D"false"/>
<verifyxpath stepid=3D"check 4" xpath=3D"/html/body/table[2]/tr[5]"
text=3D"ASIA" regex=3D"true"/>
<verifyxpath stepid=3D"check 5" =
xpath=3D"/html/body/table[2]/tr[td=3D'EUR']"
text=3D"ASIA" regex=3D"true"/>
<verifyxpath stepid=3D"check 6" xpath=3D"//tr[td=3D'EUR']" text=3D"ASIA"
regex=3D"true"/>
<verifyxpath stepid=3D"check C510 for bond daily365 "
xpath=3D"/html/body/table/tr[td=3D'DAILY365']/td[2]" text=3D"EUR"
regex=3D"false"/>
<not>
	<verifyxpath stepid=3D"only ASIA direct tr select"
xpath=3D"/html/body/table[2]/tr[td=3D'EUR']" text=3D"^ASIA$" =
regex=3D"true"/>
	<verifyxpath stepid=3D"only ASIA via global tr select"
xpath=3D"//tr[td=3D'EUR']" text=3D"^ASIA$" regex=3D"true"/>
</not>