I found a problem trying to use Selenium WebDriver for testing our application. The issue is in unstable pop-ups focusing in IE9. It is not always reproducible, it takes pl
String currentWindowHandle = driver.getWindowHandle();
driver.findElement(By.cssSelector(locator)).click();
Set windows = driver.getWindowHandles();
for (String window : windows) {
if (!window.equals(currentWindowHandle)) {
driver.switchTo().window(window);
driver.close();
}
}
driver.switchTo().window(currentWindowHandle);