How can I check whether a given text string is present on the current page using Selenium?
The code is this:
def elem = driver.findElement(By.xpath("//*[contains(.,'search_text')]")); if (elem == null) println("The text is not found on the page!");
2.1m questions
2.1m answers
60 comments
57.0k users