RE: 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!!

roshan3506 Train Asked on September 20, 2014 in Selenium WebDriver.
Add Comment
2 Answers

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.