嗨,我在python脚本中使用了未检测到的chromedriver,但大约一个月前我遇到了一个问题。它工作得很好,直到有一天脚本显示了这个错误
Traceback (most recent call last):
File "D:New foldermain.py", line 3, in <module>
driver = uc.Chrome()
^^^^^^^^^^^
File "C:UsersmickoAppDataLocalProgramsPythonPython311Libsite-packagesundetected_chromedriver__init__.py", line 240, in __init__
patcher.auto()
File "C:UsersmickoAppDataLocalProgramsPythonPython311Libsite-packagesundetected_chromedriverpatcher.py", line 127, in auto
release = self.fetch_release_number()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersmickoAppDataLocalProgramsPythonPython311Libsite-packagesundetected_chromedriverpatcher.py", line 148, in fetch_release_number
return LooseVersion(urlopen(self.url_repo + path).read().decode())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersmickoAppDataLocalProgramsPythonPython311Liburllibrequest.py", line 216, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersmickoAppDataLocalProgramsPythonPython311Liburllibrequest.py", line 519, in open
response = self._open(req, data)
^^^^^^^^^^^^^^^^^^^^^
File "C:UsersmickoAppDataLocalProgramsPythonPython311Liburllibrequest.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersmickoAppDataLocalProgramsPythonPython311Liburllibrequest.py", line 496, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "C:UsersmickoAppDataLocalProgramsPythonPython311Liburllibrequest.py", line 1391, in https_open
return self.do_open(http.client.HTTPSConnection, req,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersmickoAppDataLocalProgramsPythonPython311Liburllibrequest.py", line 1317, in do_open
h = http_class(host, timeout=req.timeout, **http_conn_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersmickoAppDataLocalProgramsPythonPython311Libhttpclient.py", line 1421, in __init__
context = ssl._create_default_https_context()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersmickoAppDataLocalProgramsPythonPython311Libssl.py", line 777, in create_default_context
context.load_default_certs(purpose)
File "C:UsersmickoAppDataLocalProgramsPythonPython311Libssl.py", line 598, in load_default_certs
self._load_windows_store_certs(storename, purpose)
File "C:UsersmickoAppDataLocalProgramsPythonPython311Libssl.py", line 588, in _load_windows_store_certs
self.load_verify_locations(cadata=certs)
ssl.SSLError: [ASN1] nested asn1 error (_ssl.c:4004)
Exception ignored in: <function Patcher.__del__ at 0x000002D63A314400>
Traceback (most recent call last):
File "C:UsersmickoAppDataLocalProgramsPythonPython311Libsite-packagesundetected_chromedriverpatcher.py", line 273, in __del__
time.sleep(0.1)
OSError: [WinError 6] The handle is invalid
我正在使用他们提供的脚本
import undetected_chromedriver as uc
driver = uc.Chrome()
driver.get('https://nowsecure.nl')
我尝试了不同的python版本,但也不起作用。不知道是什么原因导致了问题。
使用driver = uc.Chrome(use_subprocess=True)
而不是driver = uc.Chrome()