How can I check if some text exist or not in the page using Selenium?
With XPath, it’s not that hard. Simply search for all elements containing the given text: List<WebElement> list = driver.findElements(By.xpath(“//*[contains(text(),'” + text + “‘)]”)); Assert.assertTrue(“Text not found!”, list.size() > 0); The official documentation is not very supportive with tasks like this, but it is the basic tool nonetheless. The JavaDocs are greater, but it takes some … Read more