IFrame:

An iFrame is an associate with hypertext mark-up language document embedded within the present hypertext mark-up language document on a website. iFrame hypertext mark-up language part is employed to insert content from another supply, like a commercial, into an internet page. Internet designers will modification the iFrame’s content while not creating them reloads the entire website. A website will have multiple frames on one page. And a frame can even have inner frames.

IFrame could be a web content that is embedded in associate degree other web content or a hypertext mark-up language document embedded within another hypertext mark-up language document.

Learn more about this technology Selenium Online Training in Bangalore in this overview.

IFrame stands for Inline Frame is hypertext mark-up language document that’s enclosed in another hypertext mark-up language document and is employed to put the contents from another. Almost all website includes IFrame now every day, wherever they need to be displaying an advertisement to be taking a part in videos of alternative sources.

iFrames, we have other ways of handling a frame

 driver.switchTo().frame(intarg0):

Select a frame by its zero-based index. That is, if a page has multiple frames the primary frame would be at index “0”, the second at index “1” soon. Once the frame is chosen or navigated, all calls on the web driver interface into a iframe it focus by currently on the frame whatever operations we have a tendency we have a tendency to attempt to perform on pages won’t work and throws part not found as we have a tendency to navigated and switched to border.

Select a frame by its name or ID. Frames placed by matching name attribute square measure continuously given precedence over those matched by ID.

driver.switchTo().frame(WebElementframeElement):

Select a frame and it is placed in a web element and cannot notice the frames by simply by seeing the page by inspecting a firebug. We cannot notice the frames by simply seeing the page or by inspecting firebug.

By observing Right click on the page and click on ‘View Page Source’ and Search with the ‘iframe’, if you’ll be able to realize associate degree tag name with the ‘iframe’ then it’s intending a page consisting an iframe.

We will use this to be told iFrame handling logic. Before beginning we’ve to know that to figure with totally different iFrames on a page we’ve to modify between these iFrames. To modify between iFrames we’ve to use the driver’s switchTo().frame command.

We will use the switchTo().frame() in 3 ways:

switchTo.frame(int frameNumber): Pass the frame index and driver can switch to its frame.
switchTo.frame(string frameNameOrId): Pass the frame part Name or ID and a driver can switch to it a frame.

switchTo.frame(WebElement frameElement): Pass the frame net part and driver can switch to its frame.

Index of iFrame is that the position at that it happens within the hypertext mark-up language page. Within the higher than example we’ve found a total variety of iFrames. Within the sample page, we have 2 IFrames, index of iFrame starts from zero. Thus there are 2 iFrames on the page with index zero and one. Index zero is going to be the iFrame that exists.

Multiple iframes for a webpage:

Number of Iframes executed in a form of JavaScript and web elements in a form of tag name in a frame.

Switch to frames by Index:

Index of an iFrame is that the position at that it happens within the markup language page. Within the higher than example we’ve found the total variety of iFrames. Within the sample page, we have 2 IFrames, index of iFrame starts from zero. Thus there square measure 2 iFrames on the page with index zero and one. Index zero is the iFrame that exists.

Switch to frames by Name:

Now if you are taking a glance at the HTML code of iFrame you will notice that it’s named attribute. Name attribute incorporates a price iframe1. We will switch to the iFrame the name by mistreatment the command driver.switchTo().frame.

Switch to border ID:

Similar to the name attribute within the iFrame tag we tend to even have the ID attributes. We will use that additionally to change to the frame. All we have to try and do is pass the id to the switchTo command like this driver.switchTo().

Get in touch with Online IT Guru for mastering the Selenium Online Course.

Recommended Audience:

Software developers

ETL developers

Project Managers

Team Lead’s

Prerequisites:

Prerequisites for learning Selenium. It’s good to have knowledge of basic Concepts like HTML and core Java But it is not mandatory. Trainers of Online IT Guru will teach you if you don’t have knowledge of those Concepts.

 
Drop Us A Query

100% Secure Payments. All major credit & debit cards accepted.