Identify Iframe and problems with IFRAME using Selenium RC
When you choose Selenium RC for web automation one need to actually evaluate to ensure whether Selenium fit to your application technology or not. Based on need one can eitehr incldue AJAX, IFRAME, Flash etc for better user interface. Adding such technolgies cause hurdles for automation engineers. Though there are many build in support for Selenium RC for some of them we need tweak selenium RC to overcome such hurdles.
Dealing with IFRAME: IFrame is part of webpage which contain entirely differnt content than page. IFEAME intrun point to diffent html page. IFRAME html tag will be used for to have an IFRAME in a web page. Normally we use IFRAME to represent tree kind of strucuture like Page Index, Org Strucutre like that.
IFRAME is differnt than Modal dialog. Modal dialog should be closed before you access parent page. But with IFRAME we can access Parent window unless restricted by developer.
IFRAME tag is used to represent this in web page developement.
Let assume that in Bank application one need to select an account type in IFRame and then check account details by administrator.
The main problem that one encounter when delaing with IFRAME is set foucus to IFRAME do some actions in IFRAME and then close IFRAME and perform few action again in Parent window.
As I sadi IFRAME is independent HTML page one need to get Identifier of IFRAME. Using Internet developer tool bar FireBug one can get IFRAME id. There will mutliple IFRAME tags some times so one need to get IFRAME id of root levels.
Then use selectFrame(FrameID) of Selenium command. This will focuse the control to IFRAME. Now do some actions. Here sometime user face proble to focuse to IFRAME. In such cases first focus selenium to Parent window using selectwindow("null"). "null" is parent window id.
So once you are done with actions in IFRAME you close the IFRAME either clicking on OK or Close button. Before you perform any action in parent window now, first retun focuse again to parent window using selectWindow("null").
Try this once and post if you have any questions or comments here!!
Like it on Facebook, +1 on Google, Tweet it or share this article on other bookmarking websites.