我正在尝试使用以下设置方法创建FF驱动程序
protected WebDriver driver;
@BeforeClass
public void ffsetup(){
FirefoxOptions options = new FirefoxOptions();
options.setBinary("C:\\Program Files\\Mozilla Firefox\\firefox.exe");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
System.setProperty("webdriver.gecko.driver","C:\\Selenium\\Drivers\\FF\\geckodriver.exe");
capabilities.setCapability("moz:firefoxOptions", options);
driver = new FirefoxDriver(capabilities);
}
使用TestNG运行此测试时,将打开FF窗口,但没有任何反应(测试未运行)。它将在45000毫秒后关闭
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Files\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1496266004087 addons.xpi DEBUG Calling bootstrap method startup on e10srollout@mozilla.org version 1.14
1496266004088 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1496266004088 addons.xpi DEBUG Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1496266004089 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1496266004090 addons.xpi DEBUG Calling bootstrap method startup on webcompat@mozilla.org version 1.0
1496266004092 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1496266004092 addons.manager DEBUG Provider finished startup: XPIProvider
1496266004092 addons.manager DEBUG Starting provider: LightweightThemeManager
1496266004092 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1496266004092 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1496266004093 addons.manager DEBUG Starting provider: GMPProvider
1496266004096 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1496266004096 addons.manager DEBUG Provider finished startup: GMPProvider
1496266004096 addons.manager DEBUG Starting provider: PluginProvider
1496266004096 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1496266004097 addons.manager DEBUG Provider finished startup: PluginProvider
1496266004097 addons.manager DEBUG Completed startup sequence
1496266004429 addons.manager DEBUG Starting provider: <unnamed-provider>
1496266004430 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
1496266004430 addons.manager DEBUG Provider finished startup: <unnamed-provider>
1496266004610 DeferredSave.extensions.json DEBUG Write succeeded
1496266004611 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 19
1496266004611 DeferredSave.extensions.json DEBUG Starting timer
1496266004621 addons.repository DEBUG No addons.json found.
1496266004622 DeferredSave.addons.json DEBUG Save changes
1496266004623 DeferredSave.addons.json DEBUG Starting timer
1496266004641 addons.manager DEBUG Starting provider: PreviousExperimentProvider
1496266004642 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider
1496266004642 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider
1496266004644 DeferredSave.extensions.json DEBUG Starting write
1496266004666 DeferredSave.extensions.json DEBUG Write succeeded
1496266004676 DeferredSave.addons.json DEBUG Starting write
1496266004706 DeferredSave.addons.json DEBUG Write succeeded
[Child 5984] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-rel-w64-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 5984] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-rel-w64-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
1496266030506 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266030506 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266030507 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266032435 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266032435 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266032436 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266038481 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266038481 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266038483 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266038587 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266038587 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266038588 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:129)
at com.tplus.auto.config.Driver.ffsetup2(Driver.java:42)
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.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107)
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)
FAILED CONFIGURATION: @BeforeClass ffsetup2
org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files\Mozilla Firefox\firefox.exe) on port 7055; process output follows:
Files\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1496266004087 addons.xpi DEBUG Calling bootstrap method startup on e10srollout@mozilla.org version 1.14
1496266004088 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1496266004088 addons.xpi DEBUG Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1496266004089 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1496266004090 addons.xpi DEBUG Calling bootstrap method startup on webcompat@mozilla.org version 1.0
1496266004092 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1496266004092 addons.manager DEBUG Provider finished startup: XPIProvider
1496266004092 addons.manager DEBUG Starting provider: LightweightThemeManager
1496266004092 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1496266004092 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1496266004093 addons.manager DEBUG Starting provider: GMPProvider
1496266004096 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1496266004096 addons.manager DEBUG Provider finished startup: GMPProvider
1496266004096 addons.manager DEBUG Starting provider: PluginProvider
1496266004096 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1496266004097 addons.manager DEBUG Provider finished startup: PluginProvider
1496266004097 addons.manager DEBUG Completed startup sequence
1496266004429 addons.manager DEBUG Starting provider: <unnamed-provider>
1496266004430 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
1496266004430 addons.manager DEBUG Provider finished startup: <unnamed-provider>
1496266004610 DeferredSave.extensions.json DEBUG Write succeeded
1496266004611 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 19
1496266004611 DeferredSave.extensions.json DEBUG Starting timer
1496266004621 addons.repository DEBUG No addons.json found.
1496266004622 DeferredSave.addons.json DEBUG Save changes
1496266004623 DeferredSave.addons.json DEBUG Starting timer
1496266004641 addons.manager DEBUG Starting provider: PreviousExperimentProvider
1496266004642 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider
1496266004642 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider
1496266004644 DeferredSave.extensions.json DEBUG Starting write
1496266004666 DeferredSave.extensions.json DEBUG Write succeeded
1496266004676 DeferredSave.addons.json DEBUG Starting write
1496266004706 DeferredSave.addons.json DEBUG Write succeeded
[Child 5984] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-rel-w64-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 5984] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-rel-w64-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
1496266030506 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266030506 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266030507 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266032435 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266032435 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266032436 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266038481 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266038481 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266038483 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266038587 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266038587 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
1496266038588 addons.xpi DEBUG Add-on fxdriver@googlecode.com blocks e10s rollout.
使用Chrome和IE驱动程序运行我的测试没有问题,但无法使FF正常工作。
答案 0 :(得分:0)
我对最新版本的Firefox有同样的问题。
然后我降级了Firefox并得到了解决。
我认为这是最新Firefox版本的兼容性问题。
您可以通过降级Firefox版本来消除此问题。
希望它会对你有所帮助。