今天复习selenium,又遇到了之前的有过的报错!!!抓紧记录下来!
报错信息
selenium.common.exceptions.WebDriverException:
Message: Can not connect to the Service chromedriver
我这里chromedriver和Google版本是对应的,所以排除版本问题~
有的搜索结果说是hosts存在问题,那接下来查看hosts
sudo vim /etc/hosts
果然缺少了localhost的相关配置
在hosts里加上 127.0.0.1 localhost
,如果注释掉了把注释打开就行,保存退出,重新运行代码
搞定!希望这个错误再也不要出现了!🙏