【问题标题】:Python : Selenium does not start the firefox browserPython:Selenium 不启动 Firefox 浏览器
【发布时间】:2020-05-13 23:01:42
【问题描述】:

尝试通过 webdriver 运行 firefox,但 firefox 不运行。正确指定所有内容(firefox 路径),即使没有发生任何事情。 非常感谢您的帮助。

[*]geckodriver.exe 被移动到/usr/bin

from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary("C:\Program Files\Mozilla Firefox\Firefox.exe")#path of Firefox.exe
driver = webdriver.Firefox(firefox_binary=binary)
driver.get("https://google.com")

【问题讨论】:

  • 您看到任何错误吗?

标签: python selenium firefox webdriver


【解决方案1】:

您必须将驱动程序放在您的 PATH 中,或者您可以指定驱动程序的路径。

driver = webdriver.Firefox(executable_path="path\to\geckodriver.exe")

如果你还没有,你可以从here下载它并放在你的python文件夹中。

【讨论】:

  • 禁用它工作的木偶,但它不加载任何 URL。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-04-02
  • 2019-03-13
  • 1970-01-01
  • 1970-01-01
  • 2016-10-14
相关资源
最近更新 更多