pythonseleniumfirefoxgeckodriversplinter

Connection Refused and Polling for changes failed: NetworkError when attempting to fetch resource error with Selenium GeckoDriver and Firefox


As per the title, now, firefox opens up, seems to do nothing, then disappears!

  1. I've run this before from a local ubuntu 16.04 VM and all was fine.

(Yes, i have upgraded to the latest of selenium etc. as follows: selenium 3.141.0 splinter 0.10.0 six 1.12.0 urllib3 1.25.3) Now, geckodriver.log shows the following:

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  
  1. I've also tried this on a remote ubuntu-16.04 VM (without a GUI ), console shows the same "connection refused" message but this time, geckodriver.log shows a different issue, as follows: (selenium 3.141.0 six 1.12.0 splinter 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
    

my test code is :

from splinter import Browser
browser = Browser()
browser.visit( 'https://www.google.com' )
browser.fill( 'q', 'splinter - python acceptance testing     for web application' )
browser.quit()

I appreciate there are similar questions posted to "connection refused" type issues with selenium... I am hoping to find a solution specific to python what seems to me as either a 'network issue' or a 'display issue'...


Solution

  • This error message...

    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
    

    ...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowsing Session i.e. Firefox Browser session.

    Your main issue is the incompatibility between the version of the binaries you are using as follows:

    So there is a clear mismatch between the GeckoDriver v0.18.0 Selenium Client v3.141.0.


    Solution

    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?


    Outro