【问题标题】:Can not connect to the Service /usr/local/bin/geckodriver in python3无法连接到python3中的服务/usr/local/bin/geckodriver
【发布时间】:2021-02-10 17:24:55
【问题描述】:

我的代码:

#!/usr/bin/python3

from selenium import webdriver

driver=webdriver.Firefox(executable_path=r'/usr/local/bin/geckodriver')
driver.get('http://www.python.org')

产生以下错误:

错误:消息:无法连接到服务 /usr/local/bin/geckodriver

我的设置:

  • Mozilla Firefox 81.0
  • 操作系统 => Parrot sec(linux)
  • Python 3.8.6
  • geckodriver 0.27.0

我该如何解决这个问题?

【问题讨论】:

标签: python python-3.x selenium selenium-webdriver geckodriver


【解决方案1】:

将 geckodriver 文件移动到 /usr/bin 并更改代码如下。

from selenium import webdriver
from selenium.webdriver.firefox.options import Options

options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)

希望对您有所帮助。 它对我有用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-02-01
    • 1970-01-01
    • 2022-01-12
    • 2021-01-29
    • 2021-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多