Juan Carlos
Juan Carlos

Reputation: 9

Using XPATH how to find a text and click on button

Bellow is my elements:

Elements

I already know how can I find the id='0' using:

.waitForElementVisible("//form[contains(@id, '0')]"). 

My current problem is how to identify "Excelente Contribuição in "<form". I need to click on text Excelente contruibuição.

I try to use this one to identify the element first, but don't work:

.waitForElementVisible("//form[contains(@id, '0') and contains(text()='Excelente contribuição')]")

Bellow is the button I need to click.

My button

Upvotes: 0

Views: 243

Answers (1)

JaSON
JaSON

Reputation: 4869

Try to use this XPath to match form by @id and div by label text:

//form[@id='0']//div[label[normalize-space()='Excelente contribuição']]

Upvotes: 1

Related Questions