即使有关于这个的大量信息,每个解决方案都不会为我工作,我试图运行一个基本的selenium脚本,我得到这个错误。有没有任何解决方案适合我的情况(注意,我使用3.10 python,我在Windows操作系统下的企业计算机上工作,安装了Zscaler,如果它是有用的)以下是我的代码:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
def openChrome():
options= Options()
options.add_experimental_option("detach", True)
driverweb= webdriver.Chrome(service=Service(ChromeDriverManager().install()), options= options)
driverweb.get('https://pypi.org/', verify=False)
driverweb.set_window_size(1000,700)
driverweb.set_window_position(0,0)
openChrome()
我尝试使用命令(webdriver-manager update --ignore_ssl=true),但我认为我用错了,因为它说webdreiver_manager不是命令。
下面是我得到的整个错误:
Traceback (most recent call last):
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 414, in connect
self.sock = ssl_wrap_socket(
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\ssl_.py", line 449, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\ssl_.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 512, in wrap_socket
return self.sslsocket_class._create(
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1070, in _create
self.do_handshake()
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1341, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 489, in send
resp = conn.urlopen(
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='chromedriver.storage.googleapis.com', port=443): Max retries exceeded with url: /109.0.5414/chromedriver_win32.zip (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\201046329\Desktop\testwebbrowser.py", line 17, in <module>
openChrome()
File "C:\Users\201046329\Desktop\testwebbrowser.py", line 12, in openChrome
driverweb= webdriver.Chrome(service=Service(ChromeDriverManager().install()), options= options)
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\webdriver_manager\chrome.py", line 39, in install
driver_path = self._get_driver_path(self.driver)
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\webdriver_manager\core\manager.py", line 30, in _get_driver_path
file = self._download_manager.download_file(driver.get_url())
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\webdriver_manager\core\download_manager.py", line 28, in download_file
response = self._http_client.get(url)
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\webdriver_manager\core\http.py", line 32, in get
resp = requests.get(url=url, verify=self._ssl_verify, stream=True, **kwargs)
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "C:\Users\201046329\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 563, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='chromedriver.storage.googleapis.com', port=443): Max retries exceeded with url: /109.0.5414/chromedriver_win32.zip (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
1条答案
按热度按时间qvtsj1bj1#
获取(网址:字符串)
verify=False
*,则会导致 * TypeError *,如下所示:verify=False
是仅对Python Requests模块有效的参数。请参阅GET and POST requests using Python中的详细信息。此用例
作为先决条件,您必须安装webdriver-manager并删除 *
verify=False
* 参数,您的代码在我的windows-10机器上可以完美地执行。