StringUtils from the
Apache commons library to check the # of matches of a
sub-string within the source code of an
I have converted the page source using the
String pageSource = driver.getPageSource();
The code I'm using to find # of matches is:
int cloudfCount = StringUtils.countMatches(pageSource, "cloudfront"); System.out.println("There are " + cloudfCount + " instances of cloudf text found within the page source.");
right-click within the page,
view source, then
Ctrl-F to find
CloudFront, I get 2 matches. Which is what I'm expecting.
But when I use the above code in an automated
Selenium script, I'm getting 5 results.
Any thoughts/ideas on where I'm going wrong?
Could it somehow be related to the fact, that the
CloudFront text is part of 2