I have this HTML:
<div>
<!-- \/ this div -->
<div>
aaa
<!-- -->
bbb
</div>
</div>
I want to select the second div
like this: "//div[contains(text(), 'bbb')]"
, but selenium don't find it.
I tested this:
System.out.println(
driver.findElement(By.xpath("//div[contains(text(), 'aaa')]")).getText()
); //aaa bbb
System.out.println(
driver.findElement(By.xpath("//div[contains(text(), 'bbb')]")).getText()
); //Unable to locate element:...
Why don't find element if I looking for text which is after a comment?