Friday 13 September 2013

Selenium : How to switch to Web Dialog window & back to Parent Browser Window

Steps are as follows -

           1.  Before clicking the link, get the handle id of the browser window.
                  String BrowserParent = driver.getWindowHandle();

     2.  After clicking the link & once Web Dialog is opened
                 String str = driver.getWindowHandle();
                 driver.switchTo().window(st); // switch to child browser

     3.  Once the operation on the web dialog box is completed.    
                driver.switchTo().window(BrowserParent); //return back to Browser window

No comments:

Post a Comment