This commit is contained in:
wv-opt-ai 2025-03-21 16:35:41 +01:00 committed by GitHub
commit 7b358f0493
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,7 +26,11 @@ class Camoufox(PlaywrightContextManager):
def __enter__(self) -> Union[Browser, BrowserContext]: def __enter__(self) -> Union[Browser, BrowserContext]:
super().__enter__() super().__enter__()
try:
self.browser = NewBrowser(self._playwright, **self.launch_options) self.browser = NewBrowser(self._playwright, **self.launch_options)
except camoufox.exceptions.InvalidProxy as e:
super().__exit__(camoufox.exceptions.InvalidProxy, e, None)
raise
return self.browser return self.browser
def __exit__(self, *args: Any): def __exit__(self, *args: Any):