How to Click the button in the table on specific row How to Click the button in the table on specific row selenium selenium

How to Click the button in the table on specific row


This can be easily achieved by XPath. There are lots of tutorials on it all over the web, try to take one. The spec is also a surprisingly good read!

Anyway, if your table row looked like this (I can't take a better guess based on data you provided):

<tr>    <td class='name'>tester</td>    <td class='description'>Some description</td>    <td class='something'>Some text</td>    <td class='actions'><a onclick="doSomething()">Delete</a></td></tr>

you would select the button based on the name like this:

//tr/td[@class='name' and text()='tester']/following-sibling::td/a[text()='Delete']

Selects:

  1. any <tr>
  2. then its <td> child with:
    • "class" attribute equal to "name"
    • inner text equal to "tester"
  3. any following sibling of that td
  4. then its <a> child with:
    • inner text equal to "Delete"