1
代碼在語境:Driver.getWindowHandles()在IE11總是返回1在Windows 10,雖然有兩個窗口開放
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);
}
此代碼工作完全在IE11在Windows 7和Windows 8.1切換到第二個窗口,但在Windows 10
不起作用在Windows 10的情況下,Java.util.NoSuchElement Exception
出現線
String winHandle=handles.iterator().next();
正在使用的硒和IE版本是2.53.1。
你有沒有得到任何解決方案? – Ronak