merge upstream: NoSuchWindowException when closing a tab

Upstream widened the except in close_all_tabs_except to catch
NoSuchWindowException; this branch had rewritten the same two lines from print
to logging. Both are wanted, so the resolution keeps the wider except and the
logger call, and takes the new import.

Claude-Session: https://claude.ai/code/session_01RCncv1HC4UvoJcYqBtwxrt
This commit is contained in:
Ethan Stoner
2026-08-30 08:47:35 -07:00
+2 -2
View File
@@ -1,5 +1,5 @@
import logging
from selenium.common.exceptions import WebDriverException, JavascriptException
from selenium.common.exceptions import WebDriverException, JavascriptException, NoSuchWindowException
from selenium import webdriver
logger = logging.getLogger(__name__)
@@ -63,7 +63,7 @@ document.dispatchEvent(new Event('visibilitychange'));
# not close is a real problem.
logger.debug("Closed tab with handle %s and URL %s.", handle, tab_url)
except WebDriverException:
except (WebDriverException, NoSuchWindowException):
logger.warning("Could not close tab with handle %s and URL %s.", handle, tab_url)
self.problematic_tabs.add(handle)
pass