Reputation: 11
I have a problem with finding text on page. I found solution for single occurrence like:
if "tutu" in driver.page_source:
else:
But now I'm looking for some solution to find 2 same text. ("tudu" and other "tudu")
Upvotes: 0
Views: 127
Reputation: 33359
Use the count()
string method.
if driver.page_source.count("some text") == 2:
Incase, two or more than two is okay:
if driver.page_source.count("some text") >= 2:
Upvotes: 2