LambdaTest Community

Find answers, support, and inspiration from other users

Questions
LambdaTest Community
Answered

How do I find element by text in Selenium Webdriver?

Can anyone tell me how do I find element by text in Selenium Webdriver.

Up Vote Down Vote 0 Votes
Posted 4 months ago

Answers


You can find the element using xpath function text().

XPath using text() function :

Syntax:.//*[text()=’VisibleText’]

usage : driver.FindElement(By.XPath(“.//*[text()='Our People'] ”))

This XPath will select an element which contains the text “Our People”.

Up Vote Down Vote 0 Votes
Posted 2 months ago