未被检测的chromedriver
我尝试用这个代码启动YouTube,使用的是undetected chromedriver:
import undetected_chromedriver as uc
if __name__ == "__main__":
driver = uc.Chrome(headless=True)
driver.get("https://youtube.com")
但是出现了这个错误:
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
有没有办法解决这个问题呢?
我就是想打开YouTube。
2 个回答
0
我发现最新版本的selenium会导致undetected_chromedriver出现问题,建议你试着安装一个旧版本的selenium。