Reputation: 11
I tried launching youtube using undetected chromedriver with this code:
import undetected_chromedriver as uc
if __name__ == "__main__":
driver = uc.Chrome(headless=True)
driver.get("https://youtube.com")
But got this error:
Exception ignored in: <function Chrome.__del__ at 0x00000271674DBEC0>
Traceback (most recent call last):
File "C:\Users\PC\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver\__init__.py", line 843, in __del__
File "C:\Users\PC\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver\__init__.py", line 798, in quit
OSError: [WinError 6] The handle is invalid
Is there any way to fix this?
Tried to launch youtube
Upvotes: 0
Views: 1015
Reputation: 21
I noticed that the latest version of selenium is causing issues for undetected_chromedriver, try to install older version of selenium
Upvotes: 0
Reputation: 48
This seems to be a bug with undetected_chromedriver
module itself. I see an Open PR for fixing this issue.
If you want to get around this sooner, you can probably modify the init file add a try-except block around time.sleep(0.1)
similar to what's done in this commit
C:\Users\PC\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver\__init__.py
try:
time.sleep(0.1)
except OSError:
pass
Upvotes: 0