Fixing test cleanup to close all non-main windows
@@ -65,9 +65,8 @@ protected void starting(Description description) {
@Override
protected void finished(Description description) {
try {
- if (! mainWindow.equals(driver.getWindowHandle())) {
- driver.close();
- }
+ driver.getWindowHandles().stream().filter(handle -> ! mainWindow.equals(handle))
+ .forEach(handle -> driver.switchTo().window(handle).close());
} catch (Exception ignore) {
}
try {
