ayush khare
ayush khare

Reputation: 19

How to find an element with its text when it is under anchor tag in using selenium webdriver?

<a class="btn update" _ngcontent-c15="">Update</a> 

This the element I need to identify. Please help.

Upvotes: 0

Views: 1129

Answers (1)

Purus
Purus

Reputation: 5799

You didn't mention which language you are using. So I assume it's Java.

Since you don't have ID value, the simplest way is to find the element by the hyperlink test.

WebElement link = driver.findElement(By.linkText("Update"));

This will match the links in your page and get the link which has the text "Update" matching exactly.

Upvotes: 1

Related Questions