Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

I'm using Selenium WebDriver, how can I check if some text exists or not on the page? Maybe someone recommends me useful resources where I can read about it. Thanks

1 Answer

0 votes
by (62.9k points)

In Java use the following function: 

public void verifyTextPresent(String value)





and the usage would be:


try {

            Assert.IsTrue(verifyTextPresent("Selenium Wiki"));  

Console.WriteLine("Selenium Wiki test is present on  the home page"); 

catch (Exception)


 Console.WriteLine("Selenium Wiki test is not present on the home page");


Hope this helps!

Browse Categories