I have a .jsp page that I'm trying to grab the web elements from and perform click and input functions upon. After trial and error of trying to identify these web elements on the jsp page, I noticed that the page contains "iframes". I've looked up resources to be able to navigate through iframes by name, and also navigating iframes by index here
https://www.guru99.com/handling-iframes-selenium.html
However, I feel I have a special case since all the iframes I'm dealing with do not have an element ID or Name. Also, the iframe I need to navigate to is nested within other iframes.
Because as far as I know, I'm limited to using switchTo().frame(index)
since none of the iframes are named, I've already tried webDriver.switchTo().frame(index);
but because I'm dealing with nested iframes, I'm unsure that I'm getting to where I need to be. I've tried something like
webDriver.switchTo().frame(0);
webDriver.switchTo().frame(1);
webDriver.switchTo().frame(2);
webDriver.switchTo().frame(3);
to see how far I can drill down before I get an exception. It's just hard as I'm also unable to identify which iframe I'm currently in. Perhaps I need to create an object of the current iframe, and drill down that way?
The code looks something a little like this...
<iframe height="708px" width="100%" marginheight="0" frameborder="0" scrolling="auto" src="..."></iframe>
...
<iframe height="708px" width="100%" marginheight="0" frameborder="0" scrolling="auto" src="..."></iframe>
...
...<iframe onload="..." height="100%" width="100%" marginheight="0" frameborder="0" scrolling="no" src="..."></iframe>
...
... ...<iframe onload="..." height="100%" width="100%" marginheight="0" frameborder="0" scrolling="YES" src="..."></iframe>
This is where I need to be
I would expect to be able to successfully grab the web elements inside of the iframe that I'm dealing with, but I've been unsuccessful so far as I'm not sure how to navigate through these iframes. I'm assuming that
webDriver.switchTo().frame(index);
is my only option since the iframes are unnamed and have no element ID. But that's why I'm here.