不能使用firefox与selenium(org.openqa.selenium.WebDriverException:无法连接到二进制FirefoxBinary)

时间:2016-07-01 09:28:29

标签: java selenium firefox

发生此错误。它打开Firefox,但selenium无法运行代码。 selenium无法正常运行firefox 我已经尝试了最新版本的selenium和firefox 但不能这样做。

org.openqa.selenium.WebDriverException:无法连接到二进制FirefoxBinary

org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055; process output follows: 
oftware","homepageURL":"http://www.avast.com/"},"visible":true,"active":false,"userDisabled":true,"appDisabled":false,"descriptor":"C:\\Program Files\\AVAST Software\\Avast\\WebRep\\FF","installDate":1466570968358,"updateDate":1466570968358,"applyBackgroundUpdates":1,"bootstrap":false,"skinnable":false,"size":1858220,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"3.0","maxVersion":"25.0"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":0,"seen":true}
1467366014646   DeferredSave.extensions.json    DEBUG   Save changes
1467366014646   addons.xpi  DEBUG   Updating database with changes to installed add-ons
1467366014646   addons.xpi-utils    DEBUG   Updating add-on states
1467366014647   addons.xpi-utils    DEBUG   Writing add-ons list
1467366014653   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1467366014653   addons.xpi  DEBUG   Calling bootstrap method startup on e10srollout@mozilla.org version 1.0
1467366014653   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1467366014654   addons.xpi  DEBUG   Calling bootstrap method startup on firefox@getpocket.com version 1.0.3b1
1467366014655   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\loop@mozilla.org.xpi
1467366014656   addons.xpi  DEBUG   Calling bootstrap method startup on loop@mozilla.org version 1.4.1
1467366014671   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1467366014671   addons.manager  DEBUG   Provider finished startup: XPIProvider
1467366014671   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1467366014671   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1467366014671   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1467366014672   addons.manager  DEBUG   Starting provider: GMPProvider
1467366014677   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1467366014677   addons.manager  DEBUG   Provider finished startup: GMPProvider
1467366014678   addons.manager  DEBUG   Starting provider: PluginProvider
1467366014678   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1467366014678   addons.manager  DEBUG   Provider finished startup: PluginProvider
1467366014678   addons.manager  DEBUG   Completed startup sequence
1467366015610   addons.manager  DEBUG   Starting provider: <unnamed-provider>
1467366015610   addons.manager  DEBUG   Registering shutdown blocker for <unnamed-provider>
1467366015611   addons.manager  DEBUG   Provider finished startup: <unnamed-provider>
1467366015771   DeferredSave.extensions.json    DEBUG   Write succeeded
1467366015771   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 17
1467366015771   DeferredSave.extensions.json    DEBUG   Starting timer
1467366015785   addons.repository   DEBUG   No addons.json found.
1467366015786   DeferredSave.addons.json    DEBUG   Save changes
1467366015788   DeferredSave.addons.json    DEBUG   Starting timer
1467366015820   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1467366015821   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1467366015821   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1467366015827   DeferredSave.extensions.json    DEBUG   Starting write
1467366015848   DeferredSave.addons.json    DEBUG   Starting write
1467366015857   DeferredSave.extensions.json    DEBUG   Write succeeded
1467366015877   DeferredSave.addons.json    DEBUG   Write succeeded
[Child 5432] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-beta-w32-0000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 343
[Child 5432] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-beta-w32-0000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 343

Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'ips-28', ip: '192.168.1.53', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_92'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:124)
    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:207)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
    at google.gmail.<init>(gmail.java:20)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)
    at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
oftware","homepageURL":"http://www.avast.com/"},"visible":true,"active":false,"userDisabled":true,"appDisabled":false,"descriptor":"C:\\Program Files\\AVAST Software\\Avast\\WebRep\\FF","installDate":1466570968358,"updateDate":1466570968358,"applyBackgroundUpdates":1,"bootstrap":false,"skinnable":false,"size":1858220,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"3.0","maxVersion":"25.0"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":0,"seen":true}
1467366014646   DeferredSave.extensions.json    DEBUG   Save changes
1467366014646   addons.xpi  DEBUG   Updating database with changes to installed add-ons
1467366014646   addons.xpi-utils    DEBUG   Updating add-on states
1467366014647   addons.xpi-utils    DEBUG   Writing add-ons list
1467366014653   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1467366014653   addons.xpi  DEBUG   Calling bootstrap method startup on e10srollout@mozilla.org version 1.0
1467366014653   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1467366014654   addons.xpi  DEBUG   Calling bootstrap method startup on firefox@getpocket.com version 1.0.3b1
1467366014655   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\loop@mozilla.org.xpi
1467366014656   addons.xpi  DEBUG   Calling bootstrap method startup on loop@mozilla.org version 1.4.1
1467366014671   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1467366014671   addons.manager  DEBUG   Provider finished startup: XPIProvider
1467366014671   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1467366014671   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1467366014671   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1467366014672   addons.manager  DEBUG   Starting provider: GMPProvider
1467366014677   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1467366014677   addons.manager  DEBUG   Provider finished startup: GMPProvider
1467366014678   addons.manager  DEBUG   Starting provider: PluginProvider
1467366014678   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1467366014678   addons.manager  DEBUG   Provider finished startup: PluginProvider
1467366014678   addons.manager  DEBUG   Completed startup sequence
1467366015610   addons.manager  DEBUG   Starting provider: <unnamed-provider>
1467366015610   addons.manager  DEBUG   Registering shutdown blocker for <unnamed-provider>
1467366015611   addons.manager  DEBUG   Provider finished startup: <unnamed-provider>
1467366015771   DeferredSave.extensions.json    DEBUG   Write succeeded
1467366015771   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 17
1467366015771   DeferredSave.extensions.json    DEBUG   Starting timer
1467366015785   addons.repository   DEBUG   No addons.json found.
1467366015786   DeferredSave.addons.json    DEBUG   Save changes
1467366015788   DeferredSave.addons.json    DEBUG   Starting timer
1467366015820   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1467366015821   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1467366015821   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1467366015827   DeferredSave.extensions.json    DEBUG   Starting write
1467366015848   DeferredSave.addons.json    DEBUG   Starting write
1467366015857   DeferredSave.extensions.json    DEBUG   Write succeeded
1467366015877   DeferredSave.addons.json    DEBUG   Write succeeded
[Child 5432] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-beta-w32-0000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 343
[Child 5432] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-beta-w32-0000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 343

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
    ... 29 more

1 个答案:

答案 0 :(得分:0)

降级你的Firefox。似乎是兼容性的问题。您的Selenium Webdriver版本为2.53.0,其中已知版本为48.0的问题。Firefox 46.0的效果更佳。