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

❤️ 个人主页:水滴技术
🌸 订阅专栏:成功解决 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

详细错误截图:

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

解决方案

该提示是由于不安全的地址导致的,需要把这个错误屏蔽掉,可以使用 --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 教程:从入门到精通》
👍 《大数据核心技术从入门到精通》

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
社会演员多的头像社会演员多普通用户
上一篇 2023年8月8日
下一篇 2023年8月8日

相关推荐