【问题标题】:How to launch firefox (not firefox-bin) using Selenium 3.4.3,如何使用 Selenium 3.4.3 启动 firefox(不是 firefox-bin),
【发布时间】:2018-02-28 13:30:15
【问题描述】:

我想在 mac OSX 10.12.2 上使用 selenium 3.4.3 启动 firefox 进程(不是 firefox-bin)。我有 GeckoDriver 版本 0.18.0 和 firefox 版本为 55.0

默认情况下,它通过 selenium 启动 firefox-bin。我想将进程更改为“firefox”而不是“firefox-bin”。我尝试更改 site_packages 的 selenium 文件夹中 firefox_binary.py 中的路径。但它不起作用,它仍然启动了firefox-bin。

Python 版本是 2.7

【问题讨论】:

    标签: python macos selenium firefox geckodriver


    【解决方案1】:

    构建驱动时指定firefox可执行文件。

    from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
    
    // replace the path to path of your firefox process, please use absolute path
    // and make your account has the execution right on the firefox process
    binary = FirefoxBinary('F:\FirefoxPortable\Firefox.exe')
    driver = webdriver.Firefox(firefox_binary=binary)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-11-20
      • 1970-01-01
      • 2014-01-03
      • 1970-01-01
      • 1970-01-01
      • 2016-10-09
      • 2015-05-04
      相关资源
      最近更新 更多