【问题标题】:Selenium webdriver support for the latest versions of firefox and chromeSelenium webdriver 支持最新版本的 firefox 和 chrome
【发布时间】:2013-08-27 09:34:03
【问题描述】:

我正在使用 selenium-2.35.0 和 Python-2.7。 测试用例是用python编写的。

我创建驱动程序对象的python代码:

from selenium import webdriver
driver = webdriver.Remote(desired_capabilities={
    "browserName": "firefox"
})

然后运行 ​​selenium 服务器,

java - jar selenium-server-standalone-2.35.0.jar

我的代码在 Firefox 中运行 - 22 - selenium 服务器正在运行,能够在 python 中运行脚本等。所以我相信代码可以运行。

最近,我将 FireFox 更新到 23,现在我得到的只是

“[Errno 10061] 由于目标机器主动拒绝,无法建立连接。”

我想也许我需要重新启动服务器,或者其他什么。但这似乎无济于事。这个问题是否与 selenium webdriver 对最新浏览器版本的支持有关?

但截至此链接http://selenium.googlecode.com/git/java/CHANGELOG,selenium 支持 Firefox - 23。如果支持,在 Firefox - 22 中运行的代码也应该在 Firefox - 23 中运行,无需任何代码更改。

我怎样才能使相同的代码适用于 chrome?

【问题讨论】:

    标签: python google-chrome firefox selenium


    【解决方案1】:

    我发现最新版本的 Firefox 通常不能立即与 Selenium 一起使用。查看某人制作的firefox support matrix on Github。不幸的是,你唯一能做的就是stop Firefox from auto-updating 并让你的 selenium 测试运行在 firefox 最新版本减去 1 或 2 的情况下。Chrome 往往对 Selenium 开箱即用,有时 Beta 通道已经修复了一些 selenium 问题,所以尝试一下如果您有特定问题(另一方面,它可能会引入其他错误)。所以最后你需要不断地厌倦浏览器更新,并定期检查它们如何与当前版本的 selenium 一起工作。

    【讨论】:

      【解决方案2】:

      查看本指南,了解如何让 Selenium 使用回滚版本的 Firefox: http://inkhorn.ca/selenium-python-on-ubuntu-using-firefox/

      它还将修复与“版本 xul**.0 未在文件 libxul.so 中定义”有关的任何错误

      【讨论】:

        猜你喜欢
        • 2012-09-27
        • 2021-07-09
        • 2022-08-13
        • 1970-01-01
        • 1970-01-01
        • 2023-03-20
        • 2017-07-20
        • 2022-07-08
        • 1970-01-01
        相关资源
        最近更新 更多