Thursday, 2 May 2013

Handle iFrames | Selenium

It's easy to work with iFrames.  First, try to find all the iFrames available in web page;  Next, switch into the iframe and then come out of the iframe.


      new WebDriverWait(driver, 5)
System.out.println("Element found");
}catch (TimeoutException e) {
      System.out.println("Element not Found");     

How to Terminate iFrame?
To return back from the current iframe to main content, make use of the following script,


Handle iFrames without id | name

Check iFrames availability

Google Chrome
Use Chrome Developer debugging Tool to find all the available iFrames in the web page.

1| Open chrome web Browser
2| Press F12 key
3| Press Esc key
4| In console, you will see a filter icon followed by the dropdown <top frame>
5| Click on the dropdown to see the iFrames availability.

mozilla Firefox
Use the Firefox addon, web-developer to find all the available iframes in a web page. Selecting 'Outline Frames' lets you highlight the web page UI with iframes.

1 comment: