Is there a way to get element by XPath using JavaScript in Selenium WebDriver?

Is there a way to get element by XPath using JavaScript in Selenium WebDriver?

To find an element by its xpath, use the driver.findElement(By.xpath("")) method where the quotation marks are filled with the XPath for the element you want to search for.

await driver.findElement(By.xpath("//*[contains(text(), 'Wikipedia')]"))

Leave a reply

Your email address will not be published. Required fields are marked*

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.