【问题标题】:GeckoDriver for selenium not in global path用于硒的 GeckoDriver 不在全局路径中
【发布时间】:2017-03-04 21:20:12
【问题描述】:
/usr/bin/python2.7 /home/USER/Documents/python/tools/swagSearcher/swagSearcher.py
Traceback (most recent call last):

File "/home/lyend/Documents/python/tools/swagSearcher/swagSearcher.py", line 6, in <module>

web = webdriver.Firefox() # This is the break/error point in my code

File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 135, in __init__

self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 71, in start

os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 

Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x7f0a7e776c90>> ignored

Process finished with exit code 1

感谢您对此错误的任何帮助。 - 没有多少谷歌搜索让我找到解决方案

是的,我试过pip install -U selenium

附:基于Debian的操作系统

【问题讨论】:

  • 你可以安装geckodriver,根据你的平台获取二进制dist,并确保它在PATH中。

标签: python selenium


【解决方案1】:

所以在 linux 上;对于 rust 应用程序,这是 documentation here

更多关于 gecko-driver here的文档

基于 Ubuntu 的系统的说明。

git clone https://github.com/mozilla/geckodriver.git
cd geckodriver
chmod +x build.sh && ./build.sh
cargo build
sudo mv target/geckodriver /usr/bin
geckodriver -h

如果编译不适合你,github 上也有预编译的二进制文件。

【讨论】:

    【解决方案2】:

    更新 selenium 后我遇到了同样的问题。我将 selenium 降级到 2.53.6 版本,并且使用 Firefox28.0 它不需要 geckodriver。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-03
      • 1970-01-01
      • 2021-03-24
      • 2021-03-16
      • 1970-01-01
      • 2012-03-13
      • 2020-09-20
      • 1970-01-01
      相关资源
      最近更新 更多