运行selenium脚本,出现Can not connect to the Service chromedriver解决方法汇总!

今天运行selenium脚本,出现Can not connect to the Service chromedriver 这个错误。

我大概百度一下,主要两种解决方法:

第一种、修改hosts里面的内容:

把 取消 127.0.0.1       localhost 注释

运行selenium脚本,出现Can not connect to the Service chromedriver解决方法汇总!

第二种,修改防火墙

  关闭防火墙功能

运行selenium脚本,出现Can not connect to the Service chromedriver解决方法汇总!

以上两种方法,都可以实现,

但是,如果不想关闭防火墙,还想运行selenium脚本,有没有其他办法??

小鱼试了一下, 就是先把防火墙关闭→运行脚本→再开启防火墙→继续运行脚本!

就这种操作,脚本还是可以继续执行的!!!

就这种骚操作,即不用关闭防火墙,又可以运行脚本,这叫 一箭双雕啊~~~