mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-20 04:35:32 +00:00
bug6172: try to quit() the Selenium web driver properly when closing all windows
This commit is contained in:
+13
-5
@@ -108,12 +108,18 @@ public class WindowManager {
|
||||
}
|
||||
|
||||
private boolean isDriverAlive(WebDriver driver) {
|
||||
try {
|
||||
driver.getWindowHandles();
|
||||
return true;
|
||||
} catch (NoSuchSessionException | SessionNotCreatedException e) {
|
||||
return false;
|
||||
boolean result;
|
||||
if (driver == null) {
|
||||
result = false;
|
||||
} else {
|
||||
try {
|
||||
driver.getWindowHandles();
|
||||
result = true;
|
||||
} catch (NoSuchSessionException | SessionNotCreatedException e) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void setWindowMaximized(WebDriver driver) {
|
||||
@@ -137,6 +143,8 @@ public class WindowManager {
|
||||
|
||||
public void closeAllWindows() {
|
||||
forEachOpenedWindow(WebDriverWindow::close);
|
||||
driver.quit();
|
||||
driver = null;
|
||||
}
|
||||
|
||||
private class ManagedWebDriverWindow extends WebDriverWindow {
|
||||
|
||||
Reference in New Issue
Block a user