How to switch between multiple windows?

If there are multiple windows opened, as in: window(parent window), window(child1),window(child2),window(child3).
So now if i want to switch from :
1::window(child3) to window(child2)
2::window(child3) to window(parent)
3::window(parent) to window(child1)
How to work out this, please suggest??

Thank you!!

Train Asked on September 20, 2014 in Selenium WebDriver.
Add Comment
  • 2 Answer(s)

    Try “driver.switchTo().window("windowName");” and go through these links.

    Links:
    http://www.toolsqa.com/selenium-webdriver/switch-commands/

    http://sqa.stackexchange.com/questions/8416/how-to-switch-handle-particular-popup-window-when-multiple-popup-are-opened-an

    Vice Professor Answered on September 20, 2014.
    Add Comment

    To handle multiple windows getWindowHandles() isused with this selenium will generates a alphanumeric id to each window. Using this id we can get control among several windows.

    Set<String> allwin = driver.getWindowHandles();
    String win1 = allwin .toArray[][0];
    String win2= allwin.toArray[][1];
    driver.switchTo().window(win1);
    driver.switchTo().window(win2);

    so on

    Doctor Answered on September 23, 2014.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.