用FireFox的webdriver做自动化测试时,FireFox版本不宜过高

参考:https://code.google.com/p/selenium/issues/detail?id=7819


问题描述

用FireFox webdriver做自动化测试,先前都是正常的,但是在(2015/03/02)将FF升级到最新的版本36.0之后,就不能在自动化测试中正常启动FF了,错误提示如下:


start Firefox browser......
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
4209 DeferredSave.extensions.jsonDEBUG Starting write
1425258174226 addons.managerDEBUG shutdown
1425258174226 addons.managerDEBUG Calling shutdown blocker for XPIProvider
1425258174227 addons.xpiDEBUG shutdown
1425258174227 addons.xpi-utilsDEBUG shutdown
1425258174227 addons.managerDEBUG Calling shutdown blocker for LightweightThemeManager
1425258174228 addons.managerDEBUG Calling shutdown blocker for OpenH264Provider
1425258174229 addons.managerDEBUG Calling shutdown blocker for PluginProvider
1425258174350 DeferredSave.extensions.jsonDEBUG Write succeeded
1425258174350 addons.xpi-utilsDEBUG XPI Database saved, setting schema version preference to 16
1425258174351 addons.xpiDEBUG Notifying XPI shutdown observers
1425258174354 addons.managerDEBUG Async provider shutdown done
1425258175093 addons.managerDEBUG Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1425258175095 addons.managerDEBUG Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1425258175098 addons.xpiDEBUG startup
1425258175099 addons.xpiINFO Mapping [email protected] to D:\Users\yxi\AppData\Local\Temp\anonymous8889703980862471950webdriver-profile\extensions\[email protected]
1425258175100 addons.xpiDEBUG Ignoring file entry whose name is not a valid add-on ID: D:\Users\yxi\AppData\Local\Temp\anonymous8889703980862471950webdriver-profile\extensions\webdriver-staging
1425258175101 addons.xpiINFO Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}
1425258175101 addons.xpiDEBUG Skipping unavailable install location app-system-share
1425258175101 addons.xpiDEBUG Skipping unavailable install location app-system-local
1425258175102 addons.xpiDEBUG checkForChanges
1425258175102 addons.xpiDEBUG Loaded add-on state from prefs: {"app-profile":{"[email protected]":{"d":"D:\\Users\\yxi\\AppData\\Local\\Temp\\anonymous8889703980862471950webdriver-profile\\extensions\\[email protected]","e":true,"v":"2.43.1","st":1425258173418,"mt":1425258173152}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}","e":true,"v":"36.0","st":1425258038947,"mt":1424683016000}}}
1425258175103 addons.xpiDEBUG getModTime: Recursive scan of [email protected]
1425258175111 addons.xpiDEBUG getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1425258175112 addons.xpiDEBUG getInstallState changed: false, state: {"app-profile":{"[email protected]":{"d":"D:\\Users\\yxi\\AppData\\Local\\Temp\\anonymous8889703980862471950webdriver-profile\\extensions\\[email protected]","e":true,"v":"2.43.1","st":1425258173418,"mt":1425258173152}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}","e":true,"v":"36.0","st":1425258038947,"mt":1424683016000}}}
1425258175114 addons.xpiDEBUG No changes found
1425258175117 addons.managerDEBUG Registering shutdown blocker for XPIProvider
1425258175118 addons.managerDEBUG Registering shutdown blocker for LightweightThemeManager
1425258175119 addons.managerDEBUG Registering shutdown blocker for OpenH264Provider
1425258175119 addons.managerDEBUG Registering shutdown blocker for PluginProvider
JavaScript error: file:///D:/Users/yxi/AppData/Local/Temp/anonymous8889703980862471950webdriver-profile/extensions/[email protected]/components/driver-component.js, line 11464: TypeError: this.server_ is undefined
JavaScript error: chrome://fxdriver/content/server.js, line 38: NS_ERROR_XPC_CI_RETURNED_FAILURE: Component returned failure code: 0x80570015 (NS_ERROR_XPC_CI_RETURNED_FAILURE) [nsIJSCID.createInstance]
*** Blocklist::_preloadBlocklistFile: blocklist is disabled
1425258176134 addons.managerDEBUG Registering shutdown blocker for


at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:191)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:95)
at com.cisco.webex.uiframework.keywords.webdriver.impl.SeleniumKeywordImpl.getWebDriver(SeleniumKeywordImpl.java:93)
at com.cisco.webex.uiframework.keywords.webdriver.impl.SeleniumKeywordImpl.getDriver(SeleniumKeywordImpl.java:75)
at com.cisco.webex.uiframework.keywords.webdriver.impl.SeleniumKeywordImpl.deleteAllCookie(SeleniumKeywordImpl.java:327)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.cisco.webex.uiframework.WebexWebDriver.executeKeyword(WebexWebDriver.java:458)
at com.cisco.webex.uiframework.WebexWebDriver.deleteAllCookie(WebexWebDriver.java:332)
at com.cisco.webex.testcase.train.login.pages.LoginPage.doLogin(LoginPage.java:39)
at com.cisco.webex.testcase.train.login.pages.LoginPage.doLoginAsHost(LoginPage.java:51)
at com.cisco.webex.testcase.train.mc.testcase.hostmeeting.MCStartNormalMeetingByQuickScheduler.startNormalMeeting(MCStartNormalMeetingByQuickScheduler.java:47)
at com.cisco.webex.testcase.train.mc.testcase.hostmeeting.MCStartNormalMeetingByQuickScheduler.testStartWithWebExAudio(MCStartNormalMeetingByQuickScheduler.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)


原因

Selenium插件的升级一般都比FF的升级要滞后,从而可能会导致二者的不兼容。上述情况就是不兼容导致的


解决


将FF回滚到先前的某个版本

你可能感兴趣的:(用FireFox的webdriver做自动化测试时,FireFox版本不宜过高)