「Selenium」- Can not connect to the Service /path/to/chromedriver @20210217

爷,独闯天下 提交于 2021-02-17 22:35:59

问题描述

# python3.7 /tmp/demo.py
Traceback (most recent call last):
  File "/tmp/demo.py", line 4, in <module>
    driver = webdriver.Chrome('/srv/sharing/packages/chromedriver_linux64/chromedriver')  # Optional argument, if not specified will search path.
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/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 /srv/sharing/packages/chromedriver_linux64/chromedriver

问题原因

Selenium python: Can not connect to the Service %s" % self.path
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service geckodriver

解决办法

添加 127.0.1.1 localhost 到 /etc/hosts 文件。

相关文章

「Selenium Grid 3」- Node xxxxx has no free slots(close() vs quit())
「Selemium」- ChromeDriver only supports characters in the BMP
「Selenium」- Element XXX is not clickable at point (672, 582)

参考文献

Selenium python: Can not connect to the Service %s" % self.path
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service geckodriver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!