I have a div with a class attribute with the value textLayer
. I'm trying to get that div.
Here is my code:
WebElement jsiFrame = driver.findElement(By.tagName("iframe"));
driver.switchTo().frame(jsiFrame);
WebElement docViewerElement = driver.find(By.classname("textLayer")
(note: this isn't exactly the code but it's more or less the functions I call)
I also have a timeout where I wait 5 seconds while requesting each element so it's not a matter of the element not existing when I query it). Selenium fails to find it, even though it's very plainly there. What's more, it only fails on Chrome, Firefox finds it without any problems.
Try dynamic xpath with explicit wait.