我在生产中遇到了以下从未见过的问题。我的selenium版本2.42.2和服务器中我们使用firefox 31.0进行自动化测试。我用谷歌搜索,无法找到相关的解决方案。我在这里附加了日志,并且需要可能导致此异常的原因。
Sat Dec 09 17:33:31 IST 2017: ******Scheduler Starting******
Sat Dec 09 17:33:31 IST 2017: *****Service Started.***
Sat Dec 09 17:34:02 IST 2017: ******Scheduler Started******
Sat Dec 09 18:01:38 IST 2017: org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within 45000 ms
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'SCRAP_SERVER', ip: '192.168.1.32', os.name: 'Windows Server 2008', os.arch: 'x86', os.version: '6.0', java.version: '1.8.0_144'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.internal.SocketLock.lock(SocketLock.java:98)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:84)
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:193)
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 com.ppts.vgreports.executer.ScrapReportExecuter.execute(ScrapReportExecuter.java:134)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Sat Dec 09 19:06:09 IST 2017: 2017-12-09 Current day Started.
Sat Dec 09 19:07:24 IST 2017: 2017-12-09 Current day Completed.
Sat Dec 09 19:32:25 IST 2017: org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(D:\Program Files\Mozilla Firefox\firefox.exe) on port 7059; process output follows:
1512828072222 addons.manager DEBUG Application has been upgraded
1512828072793 addons.manager DEBUG Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1512828072794 addons.manager DEBUG Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1512828072795 addons.xpi DEBUG startup
1512828073551 addons.xpi DEBUG Skipping unavailable install location app-system-local
1512828073551 addons.xpi DEBUG Skipping unavailable install location app-system-share
1512828073824 addons.xpi DEBUG Ignoring file entry whose name is not a valid add-on ID: C:\Windows\TEMP\anonymous1082024976265747594webdriver-profile\extensions\webdriver-staging
1512828073835 addons.xpi DEBUG checkForChanges
1512828074598 addons.xpi DEBUG Directory state JSON differs: cache [] state [{"name":"winreg-app-global","addons":{"{20a82645-c095-46ed-80e3-08825760534b}":{"descriptor":"C:\\Windows\\Microsoft.NET\\Framework\\v3.5\\Windows Presentation Foundation\\DotNetAssistantExtension","mtime":1395978262666,"rdfTime":1213257870000}}},{"name":"app-global","addons":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"descriptor":"D:\\Program Files\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}","mtime":1500376842070,"rdfTime":1405567032000}}},{"name":"app-profile","addons":{"fxdriver@googlecode.com":{"descriptor":"C:\\Windows\\TEMP\\anonymous1082024976265747594webdriver-profile\\extensions\\fxdriver@googlecode.com","mtime":1512828029169,"rdfTime":1512828018138}}}]
1512828074602 addons.xpi-utils DEBUG Opening XPI database C:\Windows\TEMP\anonymous1082024976265747594webdriver-profile\extensions.json
1512828074603 addons.xpi DEBUG New add-on fxdriver@googlecode.com installed in app-profile
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
1512828076448 addons.xpi-utils DEBUG Make addon app-profile:fxdriver@googlecode.com visible
1512828076449 DeferredSave.extensions.json DEBUG Save changes
1512828076449 DeferredSave.extensions.json DEBUG Save changes
1512828076449 addons.xpi DEBUG New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global
1512828076705 addons.xpi-utils DEBUG Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible
1512828076705 DeferredSave.extensions.json DEBUG Save changes
1512828076705 DeferredSave.extensions.json DEBUG Save changes
1512828076705 addons.xpi DEBUG New add-on {20a82645-c095-46ed-80e3-08825760534b} installed in winreg-app-global
1512828076919 addons.xpi-utils DEBUG Make addon winreg-app-global:{20a82645-c095-46ed-80e3-08825760534b} visible
1512828076919 DeferredSave.extensions.json DEBUG Save changes
1512828076919 DeferredSave.extensions.json DEBUG Save changes
1512828078117 addons.xpi DEBUG Updating database with changes to installed add-ons
1512828078117 addons.xpi-utils DEBUG Updating add-on states
1512828078117 addons.xpi-utils DEBUG Writing add-ons list
1512828091438 DeferredSave.extensions.json DEBUG Starting timer
1512828091692 addons.manager DEBUG shutdown
1512828091692 addons.xpi DEBUG shutdown
1512828091692 addons.xpi-utils DEBUG shutdown
1512828091694 DeferredSave.extensions.json DEBUG Starting write
1512828095189 DeferredSave.extensions.json DEBUG Write succeeded
1512828095189 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 16
1512828095189 addons.xpi DEBUG Notifying XPI shutdown observers
1512828095191 addons.manager DEBUG Async provider shutdown done
1512828142706 addons.manager DEBUG Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1512828142707 addons.manager DEBUG Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1512828142708 addons.xpi DEBUG startup
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'SCRAP_SERVER', ip: '192.168.1.32', os.name: 'Windows Server 2008', os.arch: 'x86', os.version: '6.0', java.version: '1.8.0_144'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:130)
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:193)
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 com.ppts.vgreports.executer.ScrapReportExecuter.execute(ScrapReportExecuter.java:134)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7059 after 45000 ms. Firefox console output:
1512828072222 addons.manager DEBUG Application has been upgraded
1512828072793 addons.manager DEBUG Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1512828072794 addons.manager DEBUG Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1512828072795 addons.xpi DEBUG startup
1512828073551 addons.xpi DEBUG Skipping unavailable install location app-system-local
1512828073551 addons.xpi DEBUG Skipping unavailable install location app-system-share
1512828073824 addons.xpi DEBUG Ignoring file entry whose name is not a valid add-on ID: C:\Windows\TEMP\anonymous1082024976265747594webdriver-profile\extensions\webdriver-staging
1512828073835 addons.xpi DEBUG checkForChanges
1512828074598 addons.xpi DEBUG Directory state JSON differs: cache [] state [{"name":"winreg-app-global","addons":{"{20a82645-c095-46ed-80e3-08825760534b}":{"descriptor":"C:\\Windows\\Microsoft.NET\\Framework\\v3.5\\Windows Presentation Foundation\\DotNetAssistantExtension","mtime":1395978262666,"rdfTime":1213257870000}}},{"name":"app-global","addons":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"descriptor":"D:\\Program Files\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}","mtime":1500376842070,"rdfTime":1405567032000}}},{"name":"app-profile","addons":{"fxdriver@googlecode.com":{"descriptor":"C:\\Windows\\TEMP\\anonymous1082024976265747594webdriver-profile\\extensions\\fxdriver@googlecode.com","mtime":1512828029169,"rdfTime":1512828018138}}}]
1512828074602 addons.xpi-utils DEBUG Opening XPI database C:\Windows\TEMP\anonymous1082024976265747594webdriver-profile\extensions.json
1512828074603 addons.xpi DEBUG New add-on fxdriver@googlecode.com installed in app-profile
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
1512828076448 addons.xpi-utils DEBUG Make addon app-profile:fxdriver@googlecode.com visible
1512828076449 DeferredSave.extensions.json DEBUG Save changes
1512828076449 DeferredSave.extensions.json DEBUG Save changes
1512828076449 addons.xpi DEBUG New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global
1512828076705 addons.xpi-utils DEBUG Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible
1512828076705 DeferredSave.extensions.json DEBUG Save changes
1512828076705 DeferredSave.extensions.json DEBUG Save changes
1512828076705 addons.xpi DEBUG New add-on {20a82645-c095-46ed-80e3-08825760534b} installed in winreg-app-global
1512828076919 addons.xpi-utils DEBUG Make addon winreg-app-global:{20a82645-c095-46ed-80e3-08825760534b} visible
1512828076919 DeferredSave.extensions.json DEBUG Save changes
1512828076919 DeferredSave.extensions.json DEBUG Save changes
1512828078117 addons.xpi DEBUG Updating database with changes to installed add-ons
1512828078117 addons.xpi-utils DEBUG Updating add-on states
1512828078117 addons.xpi-utils DEBUG Writing add-ons list
1512828091438 DeferredSave.extensions.json DEBUG Starting timer
1512828091692 addons.manager DEBUG shutdown
1512828091692 addons.xpi DEBUG shutdown
1512828091692 addons.xpi-utils DEBUG shutdown
1512828091694 DeferredSave.extensions.json DEBUG Starting write
1512828095189 DeferredSave.extensions.json DEBUG Write succeeded
1512828095189 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 16
1512828095189 addons.xpi DEBUG Notifying XPI shutdown observers
1512828095191 addons.manager DEBUG Async provider shutdown done
1512828142706 addons.manager DEBUG Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1512828142707 addons.manager DEBUG Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1512828142708 addons.xpi DEBUG startup
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
... 9 more
对硒很新,不知道为什么会出现这个问题。我已经搜索过并发现大部分答案都是&#34;浏览器可能会升级或者selenium和Firefox版本可能会发生冲突&#34;。但我确保了硒版和Firefox版。它没有升级。从一年前开始,我们只使用Firefox版本为31.0。我坚持这个问题。