当前位置:首页 » 《我的小黑屋》 » 正文

解决:selenium.common.exceptions.WebDriverException:Message:Can not connect to the Service chromedriver

5 人参与  2024年04月17日 13:00  分类 : 《我的小黑屋》  评论

点击全文阅读



解决:selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service chromedriver



文章目录

解决:selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service chromedriver背景报错问题报错翻译报错位置代码报错原因解决方法方法一:关闭防火墙方法二:添加localhost与127.0.0.1的映射关系今天的分享就到此结束了



背景

在使用之前的代码时,报错:
Traceback (most recent call last):
File “xxx”, line xx, in
driver = webdriver.Chrome()
File \“xxx/webdriver.py\”, line 73, in init
self.service.start()
File \“xxx/service.py\”, line 104, in start
raise WebDriverException(\“Can not connect to the Service %s\” % self.path)
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service chromedriver



报错问题

Traceback (most recent call last):  File "xxx", line xx, in <module>    driver = webdriver.Chrome()  File \“xxx/webdriver.py\”, line 73, in init    self.service.start()  File \“xxx/service.py\”, line 104, in start    raise WebDriverException(\“Can not connect to the Service %s\” % self.path)selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service chromedriver

截图如下:

在这里插入图片描述



报错翻译

主要报错信息内容翻译如下所示:

Traceback (most recent call last):  File "xxx", line xx, in <module>    driver = webdriver.Chrome()  File \“xxx/webdriver.py\”, line 73, in init    self.service.start()  File \“xxx/service.py\”, line 104, in start    raise WebDriverException(\“Can not connect to the Service %s\” % self.path)selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service chromedriver

翻译:

追溯(最近一次通话):
文件“xxx”,第xx行,在中
driver=网络驱动程序。色度()
init中的文件“xxx/webdriver.py\”,第73行
self-service.start()
文件“xxx/service.py\”,第104行,起始
引发WebDriverException(\“无法连接到服务%s\”%self.path)
selenium.com.mon.exceptions.WebDriverException:消息:无法连接到服务chromedriver



报错位置代码

driver = webdriver.Chrome()


报错原因

经过查阅资料,发现有两种情况,可能是防火墙的设置问题,或者是localhost域名与127.0.0.1的映射问题,然后就会报错selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service chromedriver。

小伙伴们按下面的解决方法即可解决!!!



解决方法

要解决这个错误,这里总结了以下几个解决办法。

方法一:关闭防火墙

首先打开cmd,输入

ping localhost

发现一般故障,数据100%丢失
在这里插入图片描述

关闭防火墙服务
在这里插入图片描述

方法二:添加localhost与127.0.0.1的映射关系

添加localhost与127.0.0.1的映射关系到hosts文件,文件路径为:C:\Windows\System32\drivers\etc\hosts

在这里插入图片描述



今天的分享就到此结束了

欢迎点赞评论关注三连

在这里插入图片描述


点击全文阅读


本文链接:http://m.zhangshiyu.com/post/96498.html

<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

最新文章

  • 为哄白月光开心老婆亲手砍断九尾狐的八尾,我离开后她悔疯了章节目录_沈清九尾狐陆景最新目录_小说后续在线阅读_无删减免费完结_
  • 为我拍下遗照后,他却后悔分手了一口气完结_阎王江城老白故事会_小说后续在线阅读_无删减免费完结_
  • 鹿闻笙沈卿尘小说(鹿闻笙沈卿尘)+前传(鹿闻笙沈卿尘)阅读
  • 宋书砚宋南姝(春色寄南姝)TXT无套路在线+无广告结局
  • 为了一斤粮食,女儿被童养夫贱卖小众冷门_林娇柳絮林府内容精选_小说后续在线阅读_无删减免费完结_
  • 奶奶的日记小众冷门_奶奶月月宋长富热门榜首_小说后续在线阅读_无删减免费完结_
  • 越沧溟奚凝:结局+番外(浅冬薄念情丝缠)全文免费阅读无弹窗大结局_浅冬薄念情丝缠:结局+番外(浅冬薄念情丝缠)最新章节列表_笔趣阁浅冬薄念情丝缠
  • 重回八零恋爱脑治好了小说(艾子君谢思齐)结局+番外抖音新书_重回八零恋爱脑治好了小说免费阅读最新章节列表笔趣阁(艾子君谢思齐)
  • 情字何解后续_阙矜温柔冷笑前言+后续_小说后续在线阅读_无删减免费完结_
  • 婆婆总爱要我听到她的心声精心打造_婆婆老公明白晋江金榜_小说后续在线阅读_无删减免费完结_
  • 凤夭夭(听我心声后,炮灰一家集体虐渣)完整版小说阅读_听我心声后,炮灰一家集体虐渣凤夭夭全文免费阅读
  • (裴玉梁靖森)听雪灼烧:结局+番外精品选集起点章节+阅读即将发布预订

    关于我们 | 我要投稿 | 免责申明

    Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1