Search This Blog

Thursday, October 27, 2011

Identify Iframe and dealing 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 built in functions to support for Selenium RC. But for some issues we need tweak selenium RC to overcome such problems.
 IFRAME is an HTML element is an individual component of an HTML document IFRAME is part of webpage which contain entirely different content than page. IFRAME in turn 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 structure like Page Index, Org Structure 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.
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 said 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").
Have any questions or comments post here!!

No comments:

Post a Comment