user3079912
user3079912

Reputation: 81

Can we find an element using text present on a page in selenium webdriver

I am writing Selenium webdriver code using c#. Can we find an element using text present on a page like I wanted to assert that on button click, this text from a paragraph is present on the next page.

Thanks

Upvotes: 0

Views: 1857

Answers (1)

Sravan
Sravan

Reputation: 591

Yes it is possible you can try some thing like this

 driver.findElement(By.xpath("//a[contains(text(),'Text - CHOLERA UNS')]")).click()

Upvotes: 3

Related Questions