Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I came across many solutions for switching between windows, one of them is:

Set<String> allWindows = driver.getWindowHandles();
for(String currentWindow : allWindows){

But, I am unable to go to a particular window. Can someone tell me how to switch to 3rd window from parent window (using java client library)?

share|improve this question
Good answer here: stackoverflow.com/questions/11614188/… There is no way to identify child/parent windows, but you can identify them by title/url/etc. –  Sam Woods Sep 26 '13 at 18:00

1 Answer 1

The solution I would use is the WebDriver's driver.switchTo().frame() method (as per your example)

You can select the window you want using;

A number. (0 based index)
A name or ID.
A previously found WebElement.

an example

driver.switchTo().frame(driver.findElement(By.className("uniqueElement[title='The Page You Are After']")));
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.