正如标题所述,我无法通过selenium3打开FireFox。我尝试了所有可能的组合
硒3 firefox最新版本54.0.1(已验证32位或64位)以下是我的代码:
/* public class testing {
public static WebDriver d;
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver", "E:\\geckodriver.exe");
d = new FirefoxDriver();
d.manage().window().maximize();
d.get("https://www.google.com");
}
}
*/
我收到以下错误:
/* org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
lse,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"54.0.1","maxVersion":"54.0.1"}],"targetPlatforms":[],"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false,"userPermissions":null}
1502430891044 addons.xpi DEBUG getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1502430891046 DeferredSave.extensions.json DEBUG Save changes
1502430891046 addons.xpi DEBUG Updating database with changes to installed add-ons
1502430891046 addons.xpi-utils DEBUG Updating add-on states
1502430891047 addons.xpi-utils DEBUG Writing add-ons list
1502430891050 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1502430891051 addons.xpi DEBUG Calling bootstrap method startup on aushelper@mozilla.org version 2.0
1502430891052 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1502430891053 addons.xpi DEBUG Calling bootstrap method startup on e10srollout@mozilla.org version 1.50
1502430891053 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1502430891054 addons.xpi DEBUG Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1502430891055 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\screenshots@mozilla.org.xpi
1502430891055 addons.xpi DEBUG Calling bootstrap method startup on screenshots@mozilla.org version 6.6.0
1502430891055 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1502430891056 addons.xpi DEBUG Calling bootstrap method startup on webcompat@mozilla.org version 1.1
1502430891060 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1502430891060 addons.manager DEBUG Provider finished startup: XPIProvider
1502430891060 addons.manager DEBUG Starting provider: LightweightThemeManager
1502430891060 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1502430891060 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1502430891061 addons.manager DEBUG Starting provider: GMPProvider
1502430891065 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1502430891065 addons.manager DEBUG Provider finished startup: GMPProvider
1502430891066 addons.manager DEBUG Starting provider: PluginProvider
1502430891066 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1502430891066 addons.manager DEBUG Provider finished startup: PluginProvider
1502430891066 addons.manager DEBUG Completed startup sequence
1502430892611 addons.manager DEBUG Starting provider: <unnamed-provider>
1502430892612 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
1502430892613 addons.manager DEBUG Provider finished startup: <unnamed-provider>
1502430892768 DeferredSave.extensions.json DEBUG Write succeeded
1502430892768 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 19
1502430892768 DeferredSave.extensions.json DEBUG Starting timer
1502430892785 addons.repository DEBUG No addons.json found.
1502430892786 DeferredSave.addons.json DEBUG Save changes
1502430892834 DeferredSave.addons.json DEBUG Starting timer
1502430892940 addons.manager DEBUG Starting provider: PreviousExperimentProvider
1502430892940 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider
1502430892940 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider
1502430892944 DeferredSave.extensions.json DEBUG Starting write
1502430892945 DeferredSave.addons.json DEBUG Starting write
1502430892968 DeferredSave.extensions.json DEBUG Write succeeded
1502430892973 DeferredSave.addons.json DEBUG Write succeeded
[GPU 120] 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
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:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at ggg.w.main(w.java:13)
Exception in thread "main" org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files\Mozilla Firefox\firefox.exe) on port 7055; process output follows:
lse,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"54.0.1","maxVersion":"54.0.1"}],"targetPlatforms":[],"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false,"userPermissions":null}
1502430891044 addons.xpi DEBUG getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1502430891046 DeferredSave.extensions.json DEBUG Save changes
1502430891046 addons.xpi DEBUG Updating database with changes to installed add-ons
1502430891046 addons.xpi-utils DEBUG Updating add-on states
1502430891047 addons.xpi-utils DEBUG Writing add-ons list
1502430891050 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1502430891051 addons.xpi DEBUG Calling bootstrap method startup on aushelper@mozilla.org version 2.0
1502430891052 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1502430891053 addons.xpi DEBUG Calling bootstrap method startup on e10srollout@mozilla.org version 1.50
1502430891053 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1502430891054 addons.xpi DEBUG Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1502430891055 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\screenshots@mozilla.org.xpi
1502430891055 addons.xpi DEBUG Calling bootstrap method startup on screenshots@mozilla.org version 6.6.0
1502430891055 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1502430891056 addons.xpi DEBUG Calling bootstrap method startup on webcompat@mozilla.org version 1.1
1502430891060 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1502430891060 addons.manager DEBUG Provider finished startup: XPIProvider
1502430891060 addons.manager DEBUG Starting provider: LightweightThemeManager
1502430891060 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1502430891060 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1502430891061 addons.manager DEBUG Starting provider: GMPProvider
1502430891065 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1502430891065 addons.manager DEBUG Provider finished startup: GMPProvider
1502430891066 addons.manager DEBUG Starting provider: PluginProvider
1502430891066 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1502430891066 addons.manager DEBUG Provider finished startup: PluginProvider
1502430891066 addons.manager DEBUG Completed startup sequence
1502430892611 addons.manager DEBUG Starting provider: <unnamed-provider>
1502430892612 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
1502430892613 addons.manager DEBUG Provider finished startup: <unnamed-provider>
1502430892768 DeferredSave.extensions.json DEBUG Write succeeded
1502430892768 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 19
1502430892768 DeferredSave.extensions.json DEBUG Starting timer
1502430892785 addons.repository DEBUG No addons.json found.
1502430892786 DeferredSave.addons.json DEBUG Save changes
1502430892834 DeferredSave.addons.json DEBUG Starting timer
1502430892940 addons.manager DEBUG Starting provider: PreviousExperimentProvider
1502430892940 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider
1502430892940 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider
1502430892944 DeferredSave.extensions.json DEBUG Starting write
1502430892945 DeferredSave.addons.json DEBUG Starting write
1502430892968 DeferredSave.extensions.json DEBUG Write succeeded
1502430892973 DeferredSave.addons.json DEBUG Write succeeded
[GPU 120] 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
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'CI018', ip: '192.168.60.15', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
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 ggg.w.main(w.java:13)
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:
lse,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"54.0.1","maxVersion":"54.0.1"}],"targetPlatforms":[],"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false,"userPermissions":null}
1502430891044 addons.xpi DEBUG getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1502430891046 DeferredSave.extensions.json DEBUG Save changes
1502430891046 addons.xpi DEBUG Updating database with changes to installed add-ons
1502430891046 addons.xpi-utils DEBUG Updating add-on states
1502430891047 addons.xpi-utils DEBUG Writing add-ons list
1502430891050 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1502430891051 addons.xpi DEBUG Calling bootstrap method startup on aushelper@mozilla.org version 2.0
1502430891052 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1502430891053 addons.xpi DEBUG Calling bootstrap method startup on e10srollout@mozilla.org version 1.50
1502430891053 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1502430891054 addons.xpi DEBUG Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1502430891055 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\screenshots@mozilla.org.xpi
1502430891055 addons.xpi DEBUG Calling bootstrap method startup on screenshots@mozilla.org version 6.6.0
1502430891055 addons.xpi DEBUG Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1502430891056 addons.xpi DEBUG Calling bootstrap method startup on webcompat@mozilla.org version 1.1
1502430891060 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1502430891060 addons.manager DEBUG Provider finished startup: XPIProvider
1502430891060 addons.manager DEBUG Starting provider: LightweightThemeManager
1502430891060 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1502430891060 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1502430891061 addons.manager DEBUG Starting provider: GMPProvider
1502430891065 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1502430891065 addons.manager DEBUG Provider finished startup: GMPProvider
1502430891066 addons.manager DEBUG Starting provider: PluginProvider
1502430891066 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1502430891066 addons.manager DEBUG Provider finished startup: PluginProvider
1502430891066 addons.manager DEBUG Completed startup sequence
1502430892611 addons.manager DEBUG Starting provider: <unnamed-provider>
1502430892612 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
1502430892613 addons.manager DEBUG Provider finished startup: <unnamed-provider>
1502430892768 DeferredSave.extensions.json DEBUG Write succeeded
1502430892768 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 19
1502430892768 DeferredSave.extensions.json DEBUG Starting timer
1502430892785 addons.repository DEBUG No addons.json found.
1502430892786 DeferredSave.addons.json DEBUG Save changes
1502430892834 DeferredSave.addons.json DEBUG Starting timer
1502430892940 addons.manager DEBUG Starting provider: PreviousExperimentProvider
1502430892940 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider
1502430892940 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider
1502430892944 DeferredSave.extensions.json DEBUG Starting write
1502430892945 DeferredSave.addons.json DEBUG Starting write
1502430892968 DeferredSave.extensions.json DEBUG Write succeeded
1502430892973 DeferredSave.addons.json DEBUG Write succeeded
[GPU 120] 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
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
... 7 more
*/
我看到很多博客都被解释回到较低版本,但我认为这不是正确的解决方案,因为每天的Mozilla都会有更好的用户体验。因此,我更喜欢使用较新的版本。
答案 0 :(得分:0)
此错误的原因肯定是.jar文件
请尝试将您的jar文件更新到最新的3.5.0版本,我认为您的问题将得到解决
以下是获取最新版本的链接
http://www.seleniumhq.org/download/
希望它有所帮助。
答案 1 :(得分:0)
大多数情况下,当它显示错误为“1502430891044 addons.xpi DEBUG”时,这是由于版本兼容性。转到此站点
https://raw.githubusercontent.com/SeleniumHQ/selenium/master/java/CHANGELOG