我正在使用Selenium-java 2.46.0
和Firefox 38.0.5
,但当我使用selenium启动firefox时,如WebDriver driver = new FirefoxDriver();
Firefox启动失败,“Firefox已停止工作”弹出窗口:
但是,如果我手动打开firefox,则没有问题。
请您帮我理解这里可能出现的问题以及如何解决这个问题?
它出现以下错误:
Exception in thread "main" org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055; process output follows:
BUG Save changes
1435762652130 addons.xpi DEBUG Updating XPIState for {"id":"{D19CA586-DD6C-4a0a-96F8-14644F340D60}","syncGUID":"e6CXkfz5RFLW","location":"winreg-app-global","version":"IDS_SS_VERSION","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"iconURL":"chrome://vscore/content/ScriptFF.gif","icon64URL":null,"defaultLocale":{"name":"IDS_SS_NAME","description":null,"creator":"McAfee, Inc.","homepageURL":null},"visible":true,"active":false,"userDisabled":true,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Common Files\\McAfee\\SystemCore","installDate":1401346981596,"updateDate":1401346981596,"applyBackgroundUpdates":1,"bootstrap":false,"size":1724679,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"1.5","maxVersion":"9.9"}],"targetPlatforms":[],"multiprocessCompatible":false}
1435762652131 addons.xpi DEBUG Updating database with changes to installed add-ons
1435762652131 addons.xpi-utils DEBUG Updating add-on states
1435762652135 addons.xpi-utils DEBUG Writing add-ons list
1435762652178 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1435762652179 addons.manager DEBUG Provider finished startup: XPIProvider
1435762652179 addons.manager DEBUG Starting provider: LightweightThemeManager
1435762652179 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1435762652179 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1435762652180 addons.manager DEBUG Starting provider: GMPProvider
1435762652190 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1435762652190 addons.manager DEBUG Provider finished startup: GMPProvider
1435762652190 addons.manager DEBUG Starting provider: PluginProvider
1435762652191 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1435762652191 addons.manager DEBUG Provider finished startup: PluginProvider
1435762652192 addons.manager DEBUG Completed startup sequence
1435762652766 addons.manager DEBUG Starting provider: <unnamed-provider>
1435762652766 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
1435762652767 addons.manager DEBUG Provider finished startup: <unnamed-provider>
1435762652925 DeferredSave.extensions.json DEBUG Starting timer
1435762653270 DeferredSave.extensions.json DEBUG Starting write
1435762653333 addons.manager DEBUG shutdown
1435762653333 addons.manager DEBUG Calling shutdown blocker for XPIProvider
1435762653334 addons.xpi DEBUG shutdown
1435762653334 addons.xpi-utils DEBUG shutdown
1435762653335 addons.manager DEBUG Calling shutdown blocker for LightweightThemeManager
1435762653336 addons.manager DEBUG Calling shutdown blocker for GMPProvider
1435762653339 addons.manager DEBUG Calling shutdown blocker for PluginProvider
1435762653339 addons.manager DEBUG Calling shutdown blocker for <unnamed-provider>
1435762653591 DeferredSave.extensions.json DEBUG Write succeeded
1435762653592 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 16
1435762653592 addons.xpi DEBUG Notifying XPI shutdown observers
1435762653599 addons.manager DEBUG Async provider shutdown done
JavaScript error: resource://gre/modules/BookmarkHTMLUtils.jsm, line 897: NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsINavBookmarksService.removeFolderChildren]
JavaScript error: resource://gre/modules/BookmarkHTMLUtils.jsm, line 897: NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsINavBookmarksService.removeFolderChildren]
JavaScript error: jar:file:///C:/Program%20Files%20(x86)/Mozilla%20Firefox/browser/omni.ja!/components/nsBrowserGlue.js, line 1890: NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIAnnotationService.getItemsWithAnnotation]
Build info: version: '2.43.1', revision: '5163bceef1bc36d43f3dc0b83c88998168a363a0', time: '2014-09-10 09:43:55'
System info: host: 'W-GAMAHAJA-19', ip: '172.28.144.15', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_40'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:134)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:191)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at org.test.tutorials.DisableJS.main(DisableJS.java:22)
Caused by: org.openqa.selenium.WebDriverException: java.lang.InterruptedException: Process timed out after waiting for 45000 ms.
Build info: version: '2.43.1', revision: '5163bceef1bc36d43f3dc0b83c88998168a363a0', time: '2014-09-10 09:43:55'
System info: host: 'W-GAMAHAJA-19', ip: '172.28.144.15', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_40'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.os.CommandLine.waitFor(CommandLine.java:131)
at org.openqa.selenium.firefox.FirefoxBinary.waitFor(FirefoxBinary.java:222)
at org.openqa.selenium.firefox.FirefoxBinary.clean(FirefoxBinary.java:242)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:91)
... 7 more
Caused by: java.lang.InterruptedException: Process timed out after waiting for 45000 ms.
at org.openqa.selenium.os.UnixProcess.waitFor(UnixProcess.java:148)
at org.openqa.selenium.os.CommandLine.waitFor(CommandLine.java:129)
... 10 more
答案 0 :(得分:0)
尽管其他人在2.46和最新版本的Firefox上取得了成功,但我在Firefox上运行selenium时遇到了类似的问题。在每种情况下,我都可以通过降级到较旧版本的Firefox来绕过它们。