【问题标题】:Selenium hangs instantiating FirefoxDriverSelenium 挂起实例化 FirefoxDriver
【发布时间】:2012-05-29 17:50:45
【问题描述】:

我尝试开始使用 selenium(今天下载了当前版本)并复制了他们打开浏览器并执行 google 搜索的示例。

但是,程序在第一行 WebDriver driver = new FirefoxDriver(); 中永远挂起。

我已安装 Firefox 13。

线程转储: 线程[主] Thread.sleep(long) 行:不可用 [本机方法] [局部变量不可用] FirefoxBinary.sleep(long) 行:218 FirefoxBinary.clean(FirefoxProfile, File) 行:234 NewProfileExtensionConnection.start() 行:76 FirefoxDriver.startClient() 行:200 FirefoxDriver(RemoteWebDriver).(CommandExecutor, Capabilities) 行:94 FirefoxDriver.(FirefoxBinary, FirefoxProfile) 行:147 FirefoxDriver.() 行:85 Test.main(String[]) 行:24

【问题讨论】:

    标签: java selenium webdriver


    【解决方案1】:

    这些情况通常是 Firefox 和 Selenium 在兼容性方面有点“不同步”。

    您应该尝试两件事:将 Selenium 更新到最新版本和/或降级 Firefox。关注Selenium Release Notes

    【讨论】:

    • 对,Selenium 还没有发布对 Firefox 13 的支持。
    • Selenium 2.23 包括 Firefox 13 支持。
    • 我的回答是在 Firefox 13 还没有达到发布阶段之前,我已经编辑到现在。
    • 现在还有一个pageLoadTimeout。
    【解决方案2】:

    在 Selenium 2.23 中添加了对 Firefox 13 的支持。见http://code.google.com/p/selenium/source/browse/trunk/java/CHANGELOG

    【讨论】:

    • +1 谢谢。那是为我做的。通过包管理器更新了 Selenium。砰!固定。
    【解决方案3】:

    通常新浏览器很热门 - 我在其他地方寻找问题。 Webdriver 或 selenium 服务器。 http://d.pr/i/Q5Dt

    【讨论】:

      【解决方案4】:

      我一直在使用 Firefox 18,但我刚刚自动更新到 19,这似乎破坏了 webdriver。 Mozilla 在指向先前版本的链接方面并不突出:

      https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/18.0b7/mac/en-US/

      【讨论】:

        【解决方案5】:

        在尝试在无头 CentOS 服务器上实例化 webdriver 未设置显示时看到此行为。

        根据https://serverfault.com/questions/363827/how-can-i-run-firefox-on-centos-with-no-display——您可以使用 Xvfb,它为您提供了一个不需要连接到物理显示器的 X 服务器

        【讨论】:

        • 虽然理论上这可以回答这个问题,it would be preferable 在这里包含答案的基本部分,并提供链接以供参考。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-11-24
        • 2017-08-21
        • 1970-01-01
        • 1970-01-01
        • 2015-02-23
        • 2014-09-12
        相关资源
        最近更新 更多