From 1dd4a915990509d499b1037011dcbafc4a88ad42 Mon Sep 17 00:00:00 2001 From: Ramona T Date: Thu, 18 Dec 2025 10:13:15 -0500 Subject: [PATCH] attempt fix for tryolabs#142 --- requestium/requestium_mixin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requestium/requestium_mixin.py b/requestium/requestium_mixin.py index c627496a..03133c75 100644 --- a/requestium/requestium_mixin.py +++ b/requestium/requestium_mixin.py @@ -7,7 +7,7 @@ import tldextract from parsel.selector import Selector, SelectorList -from selenium.common.exceptions import WebDriverException +from selenium.common.exceptions import NoSuchWindowException, WebDriverException from selenium.webdriver.common.by import By from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver from selenium.webdriver.support import expected_conditions @@ -71,7 +71,7 @@ def ensure_add_cookie(self, cookie: dict[str, Any], override_domain: str | None cookie_domain = cookie["domain"] if cookie["domain"][0] != "." else cookie["domain"][1:] try: browser_domain = tldextract.extract(self.current_url).fqdn - except AttributeError: + except (AttributeError, NoSuchWindowException): browser_domain = "" if cookie_domain not in browser_domain: # TODO @joaqo: Check if hardcoding 'http' causes trouble.