I have a parent window, click on a link in parent window --> child window1 opens --> click on a link in child window1 --> child winodw2 opens --> click on a link in child window2 --> child window 3 opens --> click on a link in child window 3 --> child window 4 opens --> then return the control back to window4, window3, window2, window1 and parent window. Kindly help me on this using Selenium Webdriver in JAVA
Asked
Active
Viewed 376 times
0
-
What have you tried and what was the result? As you did in school... please show your work. :) It's part of the process of getting questions answered on SO. It's helpful to you because it forces you to investigate your own problem and think it through. It also proves to readers that you did your homework and made a reasonable attempt to answer your own question. Thirdly, it helps readers find and diagnose the problem resulting in a better answer for you and less time wasted for us. – JeffC Nov 06 '15 at 04:29
-
To be frank, i am not supposed to post my code in any of the public sites. So consider this as one of the scenario and help me to find a way for this query. – Cheenu A Nov 06 '15 at 05:25
-
@JeffC Take this as an scenario and provide the test script for the same. Thanks in advance – Cheenu A Nov 06 '15 at 07:20
1 Answers
0
driver.getWindowHandles();//Return all open window handles
Loop through the windows as required for your case
for (String winHandle : driver.getWindowHandles()) {
driver.switchTo().window(winHandle);
}
If one window opens new window , You need to switch to second window. Only from there you can click and goto third window. Use the above steps.

Giri
- 411
- 2
- 18
-
I tried @giri but still am unable to move the control to second child. Could you pls share the code from ur perspective, so that i can get some idea – Cheenu A Nov 06 '15 at 03:48
-
Giri can you please more elaborate on your comment ?? So that it will be useful for me to handle all the four Windows.. – Cheenu A Nov 06 '15 at 17:52