gpt4 book ai didi

python - 连接被拒绝且轮询更改失败 : NetworkError when attempting to fetch resource error with Selenium GeckoDriver and Firefox

转载 作者:行者123 更新时间:2023-12-01 00:52:49 26 4
gpt4 key购买 nike

正如标题所示,现在,firefox 打开,似乎什么也没做,然后就消失了!

  1. 我之前已经在本地 ubuntu 16.04 虚拟机上运行过这个程序,一切都很好。

(是的,我已经升级到最新的selenium等,如下: Selenium 3.141.0 split 0.10.0六1.12.0urllib3 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 显示不同的问题,如下所示:( Selenium 3.141.0六1.12.0 split 0.10.0urllib3 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()

    我很感激有类似的问题发布到“连接被拒绝”类型的问题与 Selenium ...我希望找到一个特定于Python的解决方案,在我看来是“网络问题”或“显示问题”。 ..

    最佳答案

    此错误消息...

    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 session ,即 Firefox 浏览器 session 。

    您的主要问题是您使用的二进制文件版本之间不兼容,如下所示:

    • 您的GeckoDriver版本geckodriver v0.18.0。 (根据第二组日志中的第一行...geckodriver INFO geckodriver 0.18.0...)
    • 您的 Selenium 客户端版本是 3.141.0
    • 我们不知道您的 Firefox 版本。

    因此,GeckoDriver v0.18.0 Selenium Client v3.141.0 之间存在明显的不匹配。

    <小时/>

    解决方案

    • Selenium升级到当前级别 Version 3.141.59 .
    • 将 GeckoDriver 升级到最新版本 GeckoDriver v0.24.0级别。
    • 确保 GeckoDriver 存在于所需位置。
    • GeckoDriver 对非 root 用户具有可执行权限。
    • Firefox 升级到当前 Firefox v65.0.2 级别。
    • 通过IDE清理您的项目工作区,并仅使用所需的依赖项重建项目。
    • 如果您的基本Web 客户端版本太旧,请将其卸载并安装最新的 GA 和已发布版本的Web 客户端
    • 始终在 tearDown(){} 方法中调用 driver.quit() 来关闭和销毁 WebDriverWeb Client 优雅地实例化。

    Note: Always maintain the following GeckoDriver, Selenium and Firefox Browser compatibility matrix

    supported_platforms_geckodriver_24

    You can find a relevant detailed discussionin Which Firefox browser versions supported for given Geckodriver version?

    <小时/>

    片尾

    关于python - 连接被拒绝且轮询更改失败 : NetworkError when attempting to fetch resource error with Selenium GeckoDriver and Firefox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56446337/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com