Peter
Peter

Reputation: 65

Selenium java to find the right element

I want to find the the element for the Edit:

my java code is not working.

String xpathLocater = "//a[contains(text(),'onEditFilter('modifier')')]";
return driver.findElement(By.xpath(xpathLocater));

This is the source code for the element.

<tr class="listeven">
<td>
<a onclick="return onEditFilter('modifier');" href="#">Edit</a>
</td>

</tr>

Upvotes: 0

Views: 54

Answers (1)

timbre timbre
timbre timbre

Reputation: 13995

something like

String xpathLocater = "//a[contains(@onclick,\"onEditFilter('modifier')\")]"

Upvotes: 1

Related Questions