Currently experimenting with Selenium Webdriver in Firefox and also looking to test in IE8.
Below is the structure of my HTML:
<table id="table">
<tbody>
<tr>
<td>Text1</td>
<td><a id="assign" href="/assign/1>Assign</a></td>
</tr>
<tr>
<td>Text2</td>
<td><a id="assign" href="/assign/2>Assign</a></td>
</tr>
<tr>
<td>Text3</td>
<td><a id="assign" href="/assign/3">Assign</a></td>
</tr>
</tbody>
</table>
My task at hand is:
To click on the assign link within the row containing Text1
.
After some trial and error, I have crafted an XPATH:
//*[@id='table']//tr/td//following-sibling::td//following-sibling::td//following-sibling::td//a
, which successfully targets all the assign links. On modifying it to //*[@id='table']//tr/td[text='Text1']//following-sibling::td//following-sibling::td//following-sibling::td//a
, Firebug indicates "No matching nodes".
Desiring a CSS selector instead, I attempted
#table>tbody>tr:contains('Text1')
, but received an error message from Firebug stating "Invalid CSS Selector".
Any recommendations?