Selenium WebDriver 无法与 Firefox 20 连接
Posted
技术标签:
【中文标题】Selenium WebDriver 无法与 Firefox 20 连接【英文标题】:Selenium WebDriver does not connect with Firefox 20 【发布时间】:2013-03-26 17:35:52 【问题描述】:我正在使用 selenium-server-standalone-2.28.0.jar 。 推出枢纽和 使用以下命令启动监听器
"C:\Program Files (x86)\Java\jre7\bin\Java.exe" -jar selenium-server-standalone-2.28.0.jar -role webdriver -hub http://localhost:4444/grid/register -port 5557 -browser "browserName=firefox",maxInstances=5,platform=WINDOWS,javascriptEnabled=true,TAKES_SCREENSHOT=true
打开一个空白的 Firefox 窗口,然后显示以下错误:
Execute
System.InvalidOperationException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
*** LOG addons.manager: Application has been upgraded
*** LOG addons.xpi: startup
*** LOG addons.xpi: Skipping unavailable install location app-system-local
*** LOG addons.xpi: Skipping unavailable install location app-system-share
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: C:\Users\PR~1.GRO\AppData\Local\Temp\anonymous768293325561108937webdriver-profile\extensions\webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi-utils: Opening database
*** LOG addons.xpi-utils: Creating database schema
*** LOG addons.xpi: New add-on fxdriver@googlecode.com installed in app-profile
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
*** LOG addons.xpi: New add-on 972ce4c6-7e08-4474-a285-3208198ce6fd installed in app-global
*** LOG addons.xpi: New add-on fiddlerhook@fiddler2.com installed in winreg-app-global
*** LOG addons.xpi: New add-on avg@toolbar installed in winreg-app-global
*** LOG addons.xpi: New add-on web2pdfextension@web2pdf.adobedotcom installed in winreg-app-global
*** LOG addons.xpi: Updating database with changes to installed add-ons
*** LOG addons.xpi-utils: Updating add-on states
*** LOG addons.xpi-utils: Writing add-ons list
*** LOG addons.manager: shutdown
*** LOG addons.xpi: shutdown
*** LOG addons.xpi-utils: shutdown
*** LOG addons.xpi-utils: Database closed
*** LOG addons.xpi: startup
*** LOG addons.xpi: Skipping unavailable install location app-system-local
*** LOG addons.xpi: Skipping unavailable install location app-system-share
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: C:\Users\PR~1.GRO\AppData\Local\Temp\anonymous768293325561108937webdriver-profile\extensions\webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi: No changes found
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 1002
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 844
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 809
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 85
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities, TimeSpan commandTimeout) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 117
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 106
at SHL.Test.Selenium.ScreenShotRemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities) in C:\Preethi\vs1\WebTest\SeleniumWebTest\Framework\SHL.Test.Selenium\ScreenShotRemoteWebDriver.cs:line 9
at SHL.Test.Selenium.TestContext..ctor(Action testRun, ITestEnvironment testEnvironment, DesiredCapabilities desiredCapabilities) in C:\Preethi\vs1\WebTest\SeleniumWebTest\Framework\SHL.Test.Selenium\TestContext.cs:line 31
at SHL.Test.Selenium.TestBase.InitSelenium(DesiredCapabilities desiredCapabilities, ITestEnvironment testEnvironment, Action testRun) in C:\Preethi\vs1\WebTest\SeleniumWebTest\Framework\SHL.Test.Selenium\TestBase.cs:line 112
调试时,到火狐浏览器插件列表,发现火狐webDriver与火狐20.0不兼容 当前的 Firefox webdirver 版本是 2.28.0
我可以使用哪个最新的 Firefox 版本,或者有什么替代方案可以解决这个问题?
【问题讨论】:
试用 Selenium 2.32 版。它适用于 Firefox 20。 【参考方案1】:请改用最新版本。现在是 2.32.0
见http://docs.seleniumhq.org/download/ 或直接下载http://selenium.googlecode.com/files/selenium-server-standalone-2.32.0.jar
对我有用
【讨论】:
【参考方案2】:我有 Ubuntu 12.04 64 位。 Selenium 在最近更新到 20 后停止工作。我使用的是 Eclipse(JDK 7)。我将 Eclipse.ini 改为使用 JDK 6,它开始工作。 Webdriver 偶尔挂起,但大部分时间都可以工作(这也可能是我正在测试的网站的问题)。为了安全起见,我现在禁用了 Firefox 自动更新。
【讨论】:
【参考方案3】:Firefox 20 刚刚问世,Selenium 开发人员可能需要几天时间才能解决出现的任何兼容性问题。
Selenium 的最新版本是 2.31.0(here),它将与 Firefox 19.0.2 一起使用。任何低于 2.30.0 的 Selenium 版本都无法与 FireFox 19 及更高版本一起使用,因此我建议您先尝试将 Selenium 更新到最新版本。
需要说明的是,我还没有下载并尝试过 FireFox 20,所以我不知道 Selenium 2.31.0 与它的兼容性如何。
【讨论】:
以上是关于Selenium WebDriver 无法与 Firefox 20 连接的主要内容,如果未能解决你的问题,请参考以下文章
Scrapy with selenium,webdriver 无法实例化
如何在 Selenium Webdriver 中模拟 HTML5 拖放?
无法在 Mac 上设置 ruby-selenium Webdriver