WebDriver switching to new window
时间:2022-03-18 14:51
String firstWindow = driver.getWindowHandle();
Set<String> allWindows = driver.getWindowHandles();
Iterator<String> windowsIterator = allWindows.iterator()
While(windowsIterator.hasNext()){
String windowHandle = windowsIterator.next().toString();
if(!windowHandle.equals(firstWindow)){
driver.swithTo().window(windowHandle);
break;
}
}