4 messages in com.canoo.lists.webtestRE: [Webtest] Another verifyXPath que...
FromSent OnAttachments
Tim Miller17 Oct 2005 11:21 
Denis N. Antonioli17 Oct 2005 11:59 
Tim Miller18 Oct 2005 08:19 
Colin O'Brien18 Oct 2005 08:52 
Subject:RE: [Webtest] Another verifyXPath query question
From:Colin O'Brien (coli@capetechnologies.com)
Date:10/18/2005 08:52:12 AM
List:com.canoo.lists.webtest

Hi Tim,

I don't know if there is some reason you need to start your search from the <table> level or if the page you're working on contains other span elements with the ProdID attribute, but if not perhaps the shorter;

//td/span[@title='ProdId']/

might serve your purpose a little better, that way you avoid getting mixed up with <tbody> etc...

Your original xpath translates to: table -> row -> cell -> span (with attribute ProdID) -> 2nd cell within the previous span element

However, with the html you've quoted the span element with the ProdID attribute does not contain any tables or cells only the number 76011 which is presumably what you want your xpath to locate, so perhaps my suggestion above might work out...

Cheers, Colin.

-----Original Message----- From: webt@lists.canoo.com [mailto:webt@lists.canoo.com]On Behalf Of Tim Miller Sent: 18 October 2005 16:19 To: webt@lists.canoo.com Subject: RE: [Webtest] Another verifyXPath query question

Denis,

Both of your suggestions return null and the closing span is not a typo. I am looking into that with the developer right now.

-----Original Message----- From: webt@lists.canoo.com [mailto:webt@lists.canoo.com] On Behalf Of Denis N. Antonioli Sent: Monday, October 17, 2005 12:00 PM To: webt@lists.canoo.com Subject: Re: [Webtest] Another verifyXPath query question

Hi Tim

your xpath looks for: <tr> <td> <span title="OrdLineNum">76011-2</span> <td> <span title="ProdId">76011</span> </td> </td> </tr>

That is, with the 2nd td inside the first td -- provided that the way the span are closed is a typo ;-)

What you want is either something like: //table/tbody/tr[td/span[@title='ProdId']]/td[2] =~ locate the 2nd td in the tr in which a td has a span with the title ProdId or //table/tbody/tr/td[span/@title='ProdId']/following-sibling::td[1] =~ locate the first td follwing a td with a span with the title ProdId

My experience with jaxen up to 1-1 beta 6, the version distributed with webtest, is xpath with following-sibling work in more cases than xpath with complicated selections.

The tbody is needed in all cases.

Happy webtesting dna

On 17 oct. 05, at 20:21, Tim Miller wrote:

Any idea why I cannot get this verifyXPath to work? It always returns null. I tried a few variations on this query including adding the tbody.

<verifyXPath stepid="check table"

xpath="//table/tr/td/span[@title='ProdId']/td[2]"

text="76011"/>

HTML:

<table border="1" cellspacing="0" cellpadding="1">

<tr>

<th>OrdLineNum</th>

<th>ProdId</th>

</tr>

<tr>

<td>

<span title="OrdLineNum"/>

76011-2

</span>

</td>

<td>

<span title="ProdId"/>

76011

</span>

</td>