catch NoSuchWindowException in tab_utils

This commit is contained in:
Carl Furtado
2026-08-30 11:44:04 -04:00
parent 62881d6d96
commit 619b282fd8
+2 -2
View File
@@ -1,4 +1,4 @@
from selenium.common.exceptions import WebDriverException, JavascriptException from selenium.common.exceptions import WebDriverException, JavascriptException, NoSuchWindowException
from selenium import webdriver from selenium import webdriver
GHOST_TAB_URLS = ( GHOST_TAB_URLS = (
@@ -56,7 +56,7 @@ document.dispatchEvent(new Event('visibilitychange'));
self.driver.close() self.driver.close()
print(f"[INFO] Closed tab with handle {handle} and URL {tab_url}.") print(f"[INFO] Closed tab with handle {handle} and URL {tab_url}.")
except WebDriverException: except (WebDriverException, NoSuchWindowException):
print(f"[WARNING] Could not close tab with handle {handle} and URL {tab_url}.") print(f"[WARNING] Could not close tab with handle {handle} and URL {tab_url}.")
self.problematic_tabs.add(handle) self.problematic_tabs.add(handle)
pass pass