Hello,
I'm writing test scripts in Canoo's WebTest. Basically, I need to run through a table of data and find an ID number for a specific case, then follow the link for that case's details page, which is located in a different cell along the same row. Xpath works in other test scripts I've written, finding links that exist always in the same location, but may have different urls driving them. Thank you for your help.
Basically:
I want to use xpath to reference a link in a table cell based on the location of a cell containing a related string two columns to the right along the same row. To clarify:
<table>
<tbody>
<tr>
<td><a href="link">lin k</a></td> <-- I want to point to a[1] in this cell
<td> </td>
<td>string</td> by referencing this string's td predicate -2
</tr>
</tbody>
</table>
This is my xpath expression so far. It obviously doesn't work:
//td[contains(text() , 'string')-2]/a[1]
I'm writing test scripts in Canoo's WebTest. Basically, I need to run through a table of data and find an ID number for a specific case, then follow the link for that case's details page, which is located in a different cell along the same row. Xpath works in other test scripts I've written, finding links that exist always in the same location, but may have different urls driving them. Thank you for your help.
Basically:
I want to use xpath to reference a link in a table cell based on the location of a cell containing a related string two columns to the right along the same row. To clarify:
<table>
<tbody>
<tr>
<td><a href="link">lin k</a></td> <-- I want to point to a[1] in this cell
<td> </td>
<td>string</td> by referencing this string's td predicate -2
</tr>
</tbody>
</table>
This is my xpath expression so far. It obviously doesn't work:
//td[contains(text() , 'string')-2]/a[1]
Comment