In the web application that i test, the sub pages opens as frames within the main window.
The following line of code used to work absolutely fine in the version of the application for which i coded –
webdriver.switchTo().frame(“frame_name”);
But when i ran the same code in the next version of the application, it started to fail certain places. A closer look helped me to analyze the scenarios in which it was failing –
- In the app, when the user wants to input a new account (its a banking product called Flexcube), he clicks on New button, which opens a first frame – the main frame (apart from the browser window on which it is open).
- In the main-frame, if we click on any LOV (list of values) icon – a pop up window opens. From this, the user can select the customer number (for example).
- The code to switch to frame used to work fine for main-frame. Whereas, for the popup frames (yes, pop ups were also frames), it used to fail.
The following solution helped me to overcome this problem :
List <WebElements> frames = d.findElements(by.id(“frame_name”);
if(frames.size()>0)
{
Line of codes
}
Thanks to the folks from Adobe and other company who had shared this solution.
But i’m still unable to find out as to why this pop up frames started behaving like this in new version.