Handling IFrames

IFrames (inline frames) is a HTML document which is embedded inside another HTML document in a web page called IFrames.

Selenium contains methods to switch between iframes using its index value, name, id,and WebElement(Using locator types).

Below are IFrames which are embedded in a webpage which looks like.

Iframe

Below are the some methods which use to handle IFrames.

1. len() method

This method is used to count the number of iframes on the webpage.It takes webelement as an argument.

2. switch_to.frame() method

This method is used to switch to required iframe.It takes index value, name, id,and WebElement(Using locator types) as an argument.

3. switch_to.default_content()

This method is used to switch back to default content page from iframe.