根据标题,现在,Firefox打开,似乎什么也不做,然后消失了!
(是的,我已经升级到最新的硒等,如下所示: 硒3.141.0 碎片0.10.0 六个1.12.0 urllib3 1.25.3) 现在,geckodriver.log显示以下内容:
1559646629845 geckodriver INFO Listening on 127.0.0.1:60172
1559646630836 mozprofile::profile INFO Using profile path /tmp/rust_mozprofile.5DqFww40mZ6W
1559646630851 geckodriver::marionette INFO Starting browser /usr/bin/firefox
1559646630857 geckodriver::marionette INFO Connecting to Marionette on localhost:46681
1559646631959 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1559646631960 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
1559646631960 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: about:reader*
1559646637156 Marionette INFO Listening on port 2828
console.error: BroadcastService:
receivedBroadcastMessage: handler for
remote-settings/monitor_changes
threw error:
Message: Error: Polling for changes failed: NetworkError when attempting to fetch resource..
Stack:
remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:190:13
JavaScript error: jar:file:///usr/lib/firefox/omni.ja!/components/nsUrlClassifierListManager.js, line 329: NS_ERROR_NOT_INITIALIZED: Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIUrlClassifierDBService.getTables]
JavaScript error: jar:file:///usr/lib/firefox/omni.ja!/components/nsUrlClassifierListManager.js, line 329: NS_ERROR_NOT_INITIALIZED: Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIUrlClassifierDBService.getTables]
1559646742440 Marionette INFO Stopped listening on port 2828ss
我也在远程ubuntu-16.04 VM(不带GUI)上尝试了此操作,控制台显示了相同的“连接被拒绝”消息,但这次geckodriver.log显示了另一个问题,如下所示: (硒3.141.0 六个1.12.0 碎片0.10.0 urllib3 1.25.3)
1559563047915 geckodriver INFO geckodriver 0.18.0
1559563047918 geckodriver INFO Listening on 127.0.0.1:51758
1559563049045 geckodriver::marionette INFO Starting browser /usr/bin/firefox with args ["-marionette"]
MobaXterm X11 proxy: Unsupported authorisation protocol
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Broadway display type not supported: localhost:11.0
Error: cannot open display: localhost:11.0
1559644244502 geckodriver INFO geckodriver 0.18.0
1559644244506 geckodriver INFO Listening on 127.0.0.1:53086
1559644245634 geckodriver::marionette INFO Starting browser /usr/bin/firefox with args ["-marionette"]
MobaXterm X11 proxy: Unsupported authorisation protocol
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Broadway display type not supported: localhost:10.0
Error: cannot open display: localhost:10.0
我的测试代码是:
from splinter import Browser
browser = Browser()
browser.visit( 'https://www.google.com' )
browser.fill( 'q', 'splinter - python acceptance testing for web application' )
browser.quit()
我很高兴收到与硒“连接被拒绝”类型问题类似的问题……我希望找到特定于python的解决方案,在我看来这是“网络问题”或“显示问题”。 ..
答案 0 :(得分:0)
此错误消息...
1559646629845 geckodriver INFO Listening on 127.0.0.1:60172
1559646630836 mozprofile::profile INFO Using profile path /tmp/rust_mozprofile.5DqFww40mZ6W
1559646630851 geckodriver::marionette INFO Starting browser /usr/bin/firefox
1559646630857 geckodriver::marionette INFO Connecting to Marionette on localhost:46681
1559646631959 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1559646637156 Marionette INFO Listening on port 2828
console.error: BroadcastService:
receivedBroadcastMessage: handler for
remote-settings/monitor_changes
threw error:
Message: Error: Polling for changes failed: NetworkError when attempting to fetch resource..
Stack:
remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:190:13
JavaScript error: jar:file:///usr/lib/firefox/omni.ja!/components/nsUrlClassifierListManager.js, line 329: NS_ERROR_NOT_INITIALIZED: Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIUrlClassifierDBService.getTables]
1559646742440 Marionette INFO Stopped listening on port 2828s
...表示 GeckoDriver 无法启动/产生新的 WebBrowsing会话,即 Firefox浏览器会话。
您的主要问题是所使用的二进制版本之间的不兼容性:
因此 GeckoDriver v0.18.0 Selenium Client v3.141.0 之间存在明显的不匹配。
driver.quit()
方法内调用tearDown(){}
,以优雅地关闭和销毁 WebDriver 和 Web Client 实例。注意:请始终保持以下GeckoDriver, Selenium and Firefox Browser compatibility matrix
您可以在Which Firefox browser versions supported for given Geckodriver version?
中找到相关的详细讨论