java Selenium 挂起实例化 FirefoxDriver
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10715576/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Selenium hangs instantiating FirefoxDriver
提问by stracktracer
I try to get started with selenium (downloaded the current version today) and copied their example which opens a browser and performs a google search.
我尝试开始使用 selenium(今天下载了当前版本)并复制了他们的示例,该示例打开浏览器并执行谷歌搜索。
However, the program hangs forever in the 1st line WebDriver driver = new FirefoxDriver();
.
但是,程序永远挂在第一行WebDriver driver = new FirefoxDriver();
。
I have Firefox 13 installed.
我安装了 Firefox 13。
Thread dump: Thread [main] Thread.sleep(long) line: not available [native method] [local variables unavailable] FirefoxBinary.sleep(long) line: 218 FirefoxBinary.clean(FirefoxProfile, File) line: 234 NewProfileExtensionConnection.start() line: 76 FirefoxDriver.startClient() line: 200 FirefoxDriver(RemoteWebDriver).(CommandExecutor, Capabilities) line: 94 FirefoxDriver.(FirefoxBinary, FirefoxProfile) line: 147 FirefoxDriver.() line: 85 Test.main(String[]) line: 24
回答by Arran
These cases are usually when Firefox & Selenium are a little "out of sync" in terms of compatibility.
这些情况通常是 Firefox 和 Selenium 在兼容性方面有点“不同步”。
You should try two things: update Selenium to the latest one and/or downgrade Firefox. Keeping an eye on the Selenium Release Notes
您应该尝试两件事:将 Selenium 更新到最新版本和/或降级 Firefox。密切关注Selenium 发行说明
回答by user405935
Firefox 13 support was added in Selenium 2.23. See http://code.google.com/p/selenium/source/browse/trunk/java/CHANGELOG
Selenium 2.23 中添加了 Firefox 13 支持。请参阅http://code.google.com/p/selenium/source/browse/trunk/java/CHANGELOG
回答by Steve
I've been working OK with Firefox 18, but I just got auto-updated to 19 which seems to break the webdriver. Mozilla isn't prominent with the links to prior versions:
我在 Firefox 18 上工作正常,但我刚刚自动更新到 19,这似乎破坏了 webdriver。Mozilla 与之前版本的链接并不突出:
https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/18.0b7/mac/en-US/
https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/18.0b7/mac/en-US/
回答by storm_m2138
Saw this behavior when trying to instantiate the webdriver on a headless CentOS server without display being set.
在没有设置显示的情况下尝试在无外设的 CentOS 服务器上实例化 webdriver 时看到了这种行为。
Per https://serverfault.com/questions/363827/how-can-i-run-firefox-on-centos-with-no-display-- you can use Xvfb, which gives you an X server that doesn't require connection to a physical display
根据https://serverfault.com/questions/363827/how-can-i-run-firefox-on-centos-with-no-display- 您可以使用Xvfb,它为您提供不需要的 X 服务器连接到物理显示器
回答by RDPanek
Normally a new browser's hot - I was looking for a problem elsewhere. Webdriver or selenium server. http://d.pr/i/Q5Dt
通常新浏览器很热 - 我在其他地方寻找问题。Webdriver 或 selenium 服务器。http://d.pr/i/Q5Dt