How to check if some of the text data appears on the page

Viewed 84

I would like to check if the page has a specific text. Best if I could check out a few texts right away.

For example, if there are "client", "customer", "order"

Here is the HTML code.

<div class="findText"><span>Example text. Football.</span></div>

After checking this I would use if condition as in here. This is my attempt to do this, but this is not the best option. Besides I can not check more words, I tried with || only.

 if(driver.getPageSource().contains("google"))  {

                driver.close();
                driver.switchTo().window(winHandleBefore);
                }

Besides, is it possible to throw a whole list of words in large numbers to check if they exist?

2 Answers
Related