1

I have never had to test an application that had frames.

When does it make sense to divide a window into frames?
How do I refer to (target) objects within a frame?

1
  • If your main question is how to handle frames and iFrames in Selenium, could you please edit your question to make this clear? Otherwise this question is likely to be closed as off-topic.
    – Kate Paulk
    Commented Mar 9, 2017 at 12:22

1 Answer 1

1

Frames are an older way of maintaining a sub-widget/page inside of a bigger page. With html5, css3, and javascript there is no longer any need for iframes/frames even though they are still supported and some sites still utilize them. The main goal is to split the screen into content areas and each area pulls in seperate functionality that has a different window scope based on the frame instead of the whole window. iframes are floating vs. static locations of frames.

The underlying functionality refers to the frame like it is the window, however, the browser itself does not, but segments based on that. So the view part of the window gets divided by the frames. Within each frame the elements work normally with Selenium like it's a window, but from the browser level the elements get abstracted into the frames and are not as easily identifiable.

As html5 and css3 handle all of the above without having to create extra constructs it obsoletes the frame/iframe idea...I personally hate frames as they disrupt the webpage in general.

Selenium drives off the html view of the browser. Since the frames fragment the view you have to get the focus into each frame and then select instead of going from the browser window level down like normal web pages. I usually do this by mousemove by a certain amount of pixels to get in the frame, so find a parent container for the frame and move focus there and then offset and then look again for the element. You will need to play around with the specific rendering and figure out what works best. If you want specific help there you need to post your html code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.