Unable to switch from second to third window

Hey All,

I am novice in Web driver .
There is Requirement  when i logs into application there is link “New contract”(Second window).
I am able to switch on “New Contract” window.
Again there is link “New company” on New Contract page (Second Window), i am unable to switch on  “New Company” window (third window).

Below is sequence:-
Application–>New Contract–>New Company

Thank You

amit Default Asked on September 2, 2015 in Selenium WebDriver.
Add Comment
1 Answer(s)


this will switch you to last opened window
public static void switchToWindow(WebDriver driver){
for (String win:driver.getWindowHandles()){

It will help you if you want switch back
public static String getWindow(WebDriver driver){
return driver.getWindowHandle();

public static void switchToWindow(String windowName, WebDriver driver){

victor Reviewer Answered on September 3, 2015.
Add Comment

Your Answer

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