【问题标题】:How to run webdriver test in specific version of Firefox (with Python)?如何在特定版本的 Firefox(使用 Python)中运行 webdriver 测试?
【发布时间】:2014-03-07 21:44:08
【问题描述】:

在我的机器上,我安装了 Firefox 21.0 和 Firefox 27.0.1。 如何强制 Selenium webdriver 使用给定版本的 Firefox 浏览器运行测试?

【问题讨论】:

    标签: python firefox selenium selenium-webdriver


    【解决方案1】:

    使用FirefoxBinary指定firefox二进制文件的路径:

    from selenium import webdriver
    from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
    
    browser = webdriver.Firefox(firefox_binary=FirefoxBinary('path goes here'))
    

    希望对您有所帮助。

    【讨论】:

    • 感谢您的回答!我会检查并告知。
    • 第二个问题:是否可以强制 FF 27 像不同版本的 FF(26 或 25)一样?
    • 我试过了,但不幸的是我收到了错误'FirefoxBinary' object has no attribute 'native_events_enabled'
    • 我在之前的评论中输入了不正确的错误信息。我收到Access is denied。我是否应该设置更多内容才能启动特定版本的 Firefox?
    • 更新:问题(访问被拒绝)已解决,我输入的路径不正确(错字)。
    猜你喜欢
    • 1970-01-01
    • 2014-10-07
    • 1970-01-01
    • 2017-02-10
    • 1970-01-01
    • 2012-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多