My table looks like below: clm1 clm2 clm3
- 1 b hi
- 2 c hello
- 3 d hi
Now the requirement is I have to find all the 'hi' and click on the other cell of same row. For e.g. in 1st occurance I have to click on 1 and the again on 3.
I am able to find 'hi' with below code but how to find the corresponding cell on the same row.
List rows = driver.findElements(By.xpath("//span[text()='hi']"));
<table>
<tr class="abc">
<td class="efg">
<a id="asg">1</a>
</td>
</tr>
<tr class="abc">
<td class="efg">
<span>1</span>
</td>
</tr>
<tr class="abc">
<td class="efg">
<span>1</span>
</td>
</tr>
</table>
Please ignore the typo as I am typing from mobile. Any help will be highly appreciated.