Handling Frames/IFrames In Selenium WebDriver : Part 1

Hello Folks,

In this post, we will learn :Handling Frames/IFrames in Selenium webdriver”.

What is Frame in HTML?

  • HTML frames are used to divide your browser window into multiple sections where each section can load a separate HTML document.
  • A frame can be created using tag in html. The tag is not supported in HTML5 because of usability and accessibility challenges. 
  • When you use  you split the visual real estate of a browser window into multiple frames. Each <frame> has it’s own contents and the content in one don’t spill into the next.

Example:
MainWindow.htm:

top_frame.htm:

main_frame.htm:

bottom_frame.html:

Now, open “MainWindow.htm” in a browser. You will see webpage as below:

What is an iFrame?

  • IFrame stands for inline frame which is also a HTML document.
  • An IFrame is an HTML document embedded inside another HTML document on a website. The IFrame HTML element is often used to insert content from another source, such as an advertisement, into a Web page.
  • An IFrame can have its own scrollbars and boarders.
  • We can create an IFrame using