Skip to content

Commit affccd5

Browse files
committed
attempt fix for #142
1 parent cc1d8c8 commit affccd5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

requestium/requestium_mixin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import tldextract
99
from parsel.selector import Selector, SelectorList
10-
from selenium.common.exceptions import WebDriverException
10+
from selenium.common.exceptions import NoSuchWindowException, WebDriverException
1111
from selenium.webdriver.common.by import By
1212
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
1313
from selenium.webdriver.support import expected_conditions
@@ -71,7 +71,7 @@ def ensure_add_cookie(self, cookie: dict[str, Any], override_domain: str | None
7171
cookie_domain = cookie["domain"] if cookie["domain"][0] != "." else cookie["domain"][1:]
7272
try:
7373
browser_domain = tldextract.extract(self.current_url).fqdn
74-
except AttributeError:
74+
except (AttributeError, NoSuchWindowException):
7575
browser_domain = ""
7676
if cookie_domain not in browser_domain:
7777
# TODO @joaqo: Check if hardcoding 'http' causes trouble.

0 commit comments

Comments
 (0)