14. 成功解决:ERROR:ssl_client_socket_impl.cc(992) handshake failed; returned -1, SSL error code 1, net_error -103

简介: 今天使用 Python 的 selenium 时,一直在报如下错误:[30616:22540:0328/093748.004:ERROR:ssl_client_socket_impl.cc(992)] handshake failed; returned -1, SSL error code 1, net_error -100

1e619b9cf78f5265580449a3b3665110_image_auth_key=1686704894-5SBZfm4jPdfahMtPt1MRPs-0-43edbb975ad7f3ebdadc50e77d9e063c&file_size=332738.png

❤️ 个人主页:水滴技术
🌸 订阅专栏:成功解决 BUG 合集
🚀 支持水滴:点赞👍 + 收藏⭐ + 留言💬

问题描述

今天使用 Python 的 selenium 时,一直在报如下错误:

[30616:22540:0328/093748.004:ERROR:ssl_client_socket_impl.cc(992)] handshake failed; returned -1, SSL error code 1, net_error -100

详细错误截图:

37572d796414a3357e9a4b292f5d977a_image_auth_key=1686704907-A2D4fo8SYUwaFTzQTG18d-0-70e0261f971cb76360e8b4f7054c9855&file_size=58873.png

虽然该错误不会影响正常使用,但一直刷屏也很是烦人,于是想彻底解决一下。

解决方案

该提示是由于不安全的地址导致的,需要把这个错误屏蔽掉,可以使用 --ignore-certificate-errors 来屏蔽。屏蔽后发现还有其他错误提示,也一并解决了。

主要添加了三项:

# 忽略证书错误
options.add_argument('--ignore-certificate-errors')
# 忽略 Bluetooth: bluetooth_adapter_winrt.cc:1075 Getting Default Adapter failed. 错误
options.add_experimental_option('excludeSwitches', ['enable-automation'])
# 忽略 DevTools listening on ws://127.0.0.1... 提示
options.add_experimental_option('excludeSwitches', ['enable-logging'])

下面是完整代码:

# http://chromedriver.storage.googleapis.com/index.html
service = Service("D:\chromedriver.exe")

# 配置选项
options = webdriver.ChromeOptions()
# 忽略证书错误
options.add_argument('--ignore-certificate-errors')
# 忽略 Bluetooth: bluetooth_adapter_winrt.cc:1075 Getting Default Adapter failed. 错误
options.add_experimental_option('excludeSwitches', ['enable-automation'])
# 忽略 DevTools listening on ws://127.0.0.1... 提示
options.add_experimental_option('excludeSwitches', ['enable-logging'])

# 获取驱动
driver = webdriver.Chrome(service=service, options=options)

重启后问题解决。


热门专栏

👍 《Python入门核心技术

👍 《IDEA 教程:从入门到精通

👍 《Java 教程:从入门到精通

👍 《MySQL 教程:从入门到精通

👍 《大数据核心技术从入门到精通

相关文章
|
网络安全 Python
python request SSL error 403证书错误
python request SSL error 403证书错误
392 0
|
Shell 数据库
【YashanDB知识库】YAS-00402 failed to connect socket, errno 111, error message "Connection refused"
【YashanDB知识库】YAS-00402 failed to connect socket, errno 111, error message "Connection refused"
【YashanDB知识库】YAS-00402 failed to connect socket, errno 111, error message "Connection refused"
|
Shell 数据库
【YashanDB知识库】YAS-00402 failed to connect socket, errno 111
【YashanDB知识库】YAS-00402 failed to connect socket, errno 111
|
存储 网络安全
Curl error (60): SSL peer certificate or SSH remote key was not OK for https://update.cs2c.com.cn/NS/V10/V10SP2/os/adv/lic/base/x86_64/repodata/repomd.xml [SSL: no alternative certificate subject name matches target host name 'update.cs2c.com.cn']
【10月更文挑战第30天】在尝试从麒麟软件仓库(ks10-adv-os)下载元数据时,遇到 SSL 证书验证问题。错误提示为:`Curl error (60): SSL peer certificate or SSH remote key was not OK`。可能原因包括证书不被信任、证书与域名不匹配或网络问题。解决方法包括检查网络连接、导入 SSL 证书、禁用 SSL 证书验证(不推荐)、联系仓库管理员、检查系统时间和尝试其他镜像。
5332 1
|
Android开发
SocketException: Failed to create server socket(OS Error: Permission denied, errno = 13)
SocketException: Failed to create server socket(OS Error: Permission denied, errno = 13)
455 3
|
应用服务中间件 nginx Windows
[emerg] 15060#200: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket ......
[emerg] 15060#200: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket ......
743 0
|
消息中间件 Kafka
org.apache.kafka.common.KafkaException: Socket server failed to bind to 114.115.20.100:9092: Cannot
org.apache.kafka.common.KafkaException: Socket server failed to bind to 114.115.20.100:9092: Cannot
316 0
【Error】fatal: unable to access ‘https://github.com/PanJiaChen/vue-element-admin/‘: OpenSSL SSL_read:
【Error】fatal: unable to access ‘https://github.com/PanJiaChen/vue-element-admin/‘: OpenSSL SSL_read:
|
缓存 Shell 网络安全
Github-推送代码报错“error:RPC failed;curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL,errno 10054”解决方案
Github-推送代码报错“error:RPC failed;curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL,errno 10054”解决方案
2148 0
|
监控 前端开发 API
一款基于 .NET MVC 框架开发、功能全面的MES系统
一款基于 .NET MVC 框架开发、功能全面的MES系统
850 5