'How to search by first td text and clicking in seconds td href by JUnit, Webdriver?
<div class="row">
<div class="row">
<table>
<tbody>
<tr>
<td class="list-text">
<div style="background-color: transparent;">Testing this function</div>
</td>
<td class="list-buttons" rowspan="2">
<a href="javascript:;">Config</a>
<a class="edit-button" href="javascript:;">Edit</a>
<a class="save-button" href="javascript:;" style="display:none;">Save</a>
<a href="javascript:;">Delete</a>
</td>
</tr>
<tr>
</tbody>
</table>
</div>
I need to find the element which contains the text "Testing this function" and click to link "Config".
Can't find a way to do it.
Edited: Found a way to do it:
By.xpath("//div[@class='row']/table/tbody/tr[td/div[contains(.,'Testing')]]/td[2]/a[contains(.,'Config')]")
But maybe someone has a better solution for this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
