2

Code in Context:

    Set<String> handles = driver.getWindowHandles();

        String firstWinHandle = driver.getWindowHandle(); 
        handles.remove(firstWinHandle);

        String winHandle=handles.iterator().next();

        if (winHandle!=firstWinHandle){

            //To retrieve the handle of second window, extracting the handle which does not match to first window handle

            String secondWinHandle=winHandle; //Storing handle of second window handle

            //Switch control to new window

            driver.switchTo().window(secondWinHandle);
        }

This code works perfectly on IE11 on Windows 7 and Windows 8.1 to switch to the second window, but doesn't work on Windows 10.

In case of Windows 10, Java.util.NoSuchElement Exception appears for line

String winHandle=handles.iterator().next();

Selenium and IE version being used are 2.53.1.

1 Answers1

2

I had the same problem. Disabling the protected mode in the IE settings for all zones helped.

waki
  • 85
  • 10