Firefox WebDriver无法与Firefox 32一起使用

46

我刚刚更新到Firefox 32,当我尝试运行我的Selenium Webdriver测试时,出现以下错误:

Failed to start up socket within 45000 ms. Attempted to connect to the
following addresses: 127.0.0.1:7055 OpenQA.Selenium.WebDriverException
was unhandled by user code   HResult=-2146233088   Message=Failed to
start up socket within 45000 ms. Attempted to connect to the following
addresses: 127.0.0.1:7055   Source=WebDriver   StackTrace:
       at OpenQA.Selenium.Firefox.FirefoxDriverServer.ConnectToBrowser(TimeSpan
timeToWait)
       at OpenQA.Selenium.Firefox.FirefoxDriverServer.Start()
       at OpenQA.Selenium.Firefox.FirefoxDriverCommandExecutor.Execute(Command
commandToExecute)
       at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
       at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities
desiredCapabilities)
       at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor
commandExecutor, ICapabilities desiredCapabilities)
       at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxBinary binary, FirefoxProfile profile, ICapabilities capabilities, TimeSpan
commandTimeout)
       at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxBinary binary, FirefoxProfile profile, TimeSpan commandTimeout)
       at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxBinary binary, FirefoxProfile profile)
       at OpenQA.Selenium.Firefox.FirefoxDriver..ctor()
       at SMT.Web.FunctionalTests.Drivers.Driver.GetWebDriver(Int32 browser, String page)

我原本希望能像平常一样运行测试。

有人遇到过同样的问题吗?你是如何解决的?

Selenium版本:2.41.0(作为Nuget包安装), 操作系统:Windows 7, 浏览器:Firefox, 浏览器版本:32。


你是如何开始你的测试的?请展示实际的代码。 - alecxe
1
嗨,Alecxe,测试没有启动,只有浏览器启动了,代码没问题,因为我今天早上正在运行测试,唯一改变的是升级了浏览器。 - ChrisMcLellan
1
今天早上我升级火狐浏览器后遇到了同样的 bug。我只是降级到较早的火狐版本,然后问题就得到了解决。这可能不是最好的选择,但是它是更快的方法。 - almanegra
8个回答

21

2
您可以在此处找到旧版本:https://support.mozilla.org/zh-CN/kb/install-older-version-of-firefox - Doug
请看Mite的回答,Firefox 32现在被Selenium 2.43.0支持。 - Andrei Socaciu
它可能是“受支持的”,但仍然无法工作。即使元素就在屏幕上,可点击等,我现在也收到了大量“无法将元素滚动到视图中”的错误。我仍然无法使用最新的Selenium和Firefox 32运行任何测试。真是一团糟。 - Tim Hardy
@TimHardy 你确定你的问题与Firefox版本有关吗?看看你的问题是否可以详细说明成一个单独的问题。谢谢。 - alecxe

10

是的,2.42.0和2.42.2无法与FF 32一起使用,失败原因如下:

org.openqa.selenium.WebDriverException:无法在45000毫秒内绑定到锁定端口7054

因此,策略是回滚直到2.43发布。


我使用Selenium 2.42.2和Firefox 31.0的组合解决了这个问题。请参阅Mozilla有关降级Firefox的页面:https://support.mozilla.org/en-US/kb/install-older-version-of-firefox - Matt C
如何将Firefox从32版本降级到28版本。请帮忙。 - sangeethkumar

8
他们刚刚发布了2.43.0版本(2014年9月9日)
  • 确保UnhandledAlertErrors包含由驱动程序提供的警报文本。
  • Firefox
    • 如果静默启动挂起,则确保正确终止浏览器进程(#7392)
    • Firefox 24、31和32的本机事件支持
  • 放宽websocket依赖关系到~> 1.0
  • 添加对switch_to.parent_frame的支持(感谢abotalov)
  • 修复Selenium::Server.{latest,get}的下载位置(#7049 - 感谢marekj)

Ruby https://selenium.googlecode.com/git/rb/CHANGES

Java https://selenium.googlecode.com/git/java/CHANGELOG
(这是一个关于 Java 的链接,指向 Selenium 的 CHANGELOG 页面)

它还没有发布到NodeJs上。他们仍然停留在2.42.1版本 :-( - Chexpir

3

他们关于这个问题有一个工单,并且已经在版本2.43中修复了它。

点击此处查看

我不知道他们何时发布2.43版本,所以我猜暂时可以将浏览器降级或切换到HtmlUnitDriver、ChromeDriver或OperaDriver?


1
你需要下载最新的客户端jar包。并将它们全部添加到构建路径中,根目录下会有2个jar文件,在lib子文件夹中还会有许多其他jar文件。
下载客户端:http://selenium-release.storage.googleapis.com/2.43/selenium-java-2.43.1.zip

enter image description here

source: http://www.seleniumhq.org/download/

编辑: 如果您使用Maven,可以采用更好的解决方案。https://maven.apache.org/what-is-maven.html 在Eclipse中,只需创建新的Maven项目,或在现有项目上配置 -> 转换为Maven项目。

然后插入selenium依赖项的pom。 selenium maven 当前的selenium pom:

<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.0.1</version>
</dependency>

1

与其他人建议的降级您的浏览器不同,为何不将您的WebDriver升级至2.42呢?


1
2.42版本也不支持第32版(没有点踩)。 - alecxe
我不喜欢升级 gem,除非有一个真正好的理由。这会导致一系列的更新,而且总会出现一些问题。有时候会有一些改变需要大量的工作来修复。 - B Seven
1
WebDriver 2.43.1支持Firefox 32.0.1及以下版本。在Firefox自动更新到32.0.1后,我们已经修复了这个问题。 - Shahid M Zubair
升级对我有用!为了在JMeter测试中使用Firefox Webdriver并使其与当前的Firefox v38(截至2015年5月)配合使用,我将selenium api .jar和selenium firefox .jar从版本2.44升级到2.45(删除旧文件并将新文件放入JMeters / lib文件夹中)。我从selenium Maven网站/存储库下载了.jar文件。 - Bart

1

我刚刚将浏览器降级至版本31。selenium-2.42.2无法在FF版本32上使用。


0
最新版本的Firefox WebDriver(Selenium 2.44)现在与Firefox 32兼容。但是,如果您正在Visual Studio中通过Nuget下载Selenium,请确保您已在程序包管理器控制台中选择了正确的项目。我将新的兼容版本下载到我的解决方案中,仍然遇到了45000毫秒超时错误。原来我已经更新了主项目中的Selenium,但没有更新测试项目中的Selenium。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接