Is it possible in Selenium to check if a certain text appears more than once on a page (it doesn’t matter how many times, just if it is more than once)?
I know that I can test for the text with
selenium.IsTextPresent(text)
But of course that returns true as soon as it finds the text once. Is there a way to see if text exists multiple times on a page?
You can operate on html source:
Then simple check for the index of the test and last index (as nabuchodonossor suggested in his comment):
You can also remove all html tags before checking indexes and leave the visible text only if you want to ignore comments, alt attributes, title attributes etc.