1

我已经尝试了许多其他人在 stackoverflow 以及其他网站上提供的解决方案,但似乎没有任何效果,我不知道该做什么了。这就是我基本上一直在做的事情:

from selenium import webdriver
# from chromedriver_py import binary_path

# driver = webdriver.Chrome(executable_path=binary_path)
driver = webdriver.Chrome('/usr/local/bin/chromedriver')

错误

selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /usr/local/bin/chromedriver

我试过了:

  1. 在 etc/hosts 中调整我的主机文件
  2. 使用 os 环境变量作为 chromedriver 的位置
  3. 使用 chromedriver_py 作为二进制路径
  4. 仔细检查 chromedriver 版本是否与我的 chrome 版本相同

不确定这是否相关,但我正在使用:

  • macOS Sierra 10.12.6
  • PyCharm 2019 CE
4

0 回答 0