Showing posts with label getWindowHandle. Show all posts
Showing posts with label getWindowHandle. Show all posts

Tuesday 3 December 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;
                 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);