Update __init__.py

Prevents annoying error while using with seleniumwire.

`Exception ignored in: <function Chrome.__del__ at 0x0000015A0ADFCB80>
Traceback (most recent call last):
  File "C:\Users\dupa\miniconda3\envs\snap\Lib\site-packages\undetected_chromedriver\__init__.py", line 824, in __del__
  File "C:\Users\dupa\miniconda3\envs\snap\Lib\site-packages\seleniumwire\webdriver.py", line 69, in quit
  File "C:\Users\dupa\miniconda3\envs\snap\Lib\site-packages\undetected_chromedriver\__init__.py", line 811, in quit
OSError: [WinError 6] The handle is invalid`

Seleniumwire is already calling quit() then it goes to __del__ and its trying to close again already closed process.
This commit is contained in:
11AnJo 2024-01-11 17:54:41 +01:00 committed by GitHub
parent 783b839315
commit a69a7e2ca7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -840,7 +840,11 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
self.service.process.kill()
except: # noqa
pass
self.quit()
try:
self.quit()
except OSError:
pass
@classmethod
def _ensure_close(cls, self):