selenium: [šŸ› Bug]: Geckodriver on Centos not starting

What happened?

I am writing in regard to the issue #10014

I did some extensive testing over the past few days. My code:

def get_firefox_driver(is_proxy, proxy_params):
    global_var.DEFAULT_LOAD_TIME
    options = FirefoxOptions()

    try:
        driver = webdriver.Firefox(options=options)
        time.sleep(10)
    except TimeoutException:
        print("Firefox took more than 60 seconds start!")
        print("FFEx:"+repr(e))
    except Exception as e:
        print("FFEx:"+repr(e))
        
    try:
        driver.implicitly_wait(1)
        driver.set_window_size(1920, 1080)
        driver.set_page_load_timeout(global_var.DEFAULT_LOAD_TIME)
        driver.set_script_timeout(20)
    except Exception as e:
        print("Unable to start driver {}.".format(repr(e)))
    
        driver.get("https://www.bing.com/")
    
    return driver

ERROR

CEx:SessionNotCreatedException('session not created: No matching capabilities found', None, ['#0 0x558bba045ee3 <unknown>', '#1 0x558bb9b13608 <unknown>', '#2 0x558bb9b6c2a5 <unknown>', '#3 0x558bb9b6b6c6 <unknown>', '#4 0x558bb9b6cd4d <unknown>', '#5 0x558bb9b67163 <unknown>', '#6 0x558bb9b3cbfc <unknown>', '#7 0x558bb9b3dc05 <unknown>', '#8 0x558bba077baa <unknown>', '#9 0x558bba08d651 <unknown>', '#10 0x558bba078b05 <unknown>', '#11 0x558bba08ea68 <unknown>', '#12 0x558bba06d05f <unknown>', '#13 0x558bba0a9818 <unknown>', '#14 0x558bba0a9998 <unknown>', '#15 0x558bba0c4eed <unknown>', '#16 0x7f46598adea5 <unknown>', ''])
Unable to start driver UnboundLocalError("local variable 'driver' referenced before assignment").

gekodriver.log

console.log: WebExtensions: reset-default-search: starting.
console.log: WebExtensions: reset-default-search: No addons in our list are installed.
1637925795164   geckodriver     INFO    Listening on 127.0.0.1:44759
1637925795168   mozrunner::runner       INFO    Running command: "/bin/firefox" "--marionette" "--remote-debugging-port" "40606" "-no-remote" "-profile" "/tmp/rust_mozprofileFWvysu"
Running without a11y support!
1637925795517   Marionette      INFO    Marionette enabled
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at /tmp/rust_mozprofileFWvysu/search.json.mozlz4", (void 0)))
DevTools listening on ws://localhost:40606/devtools/browser/a56408aa-1343-4f12-93ac-802bb2c7c728
1637925798414   Marionette      INFO    Listening on port 45437
1637925798496   RemoteAgent     WARN    TLS certificate errors will be ignored for this session
1637925810193   Marionette      INFO    Stopped listening on port 45437
JavaScript error: chrome://global/content/elements/browser-custom-element.js, line 1671: NotFoundError: No such JSWindowActor 'MarionetteEvents'
JavaScript error: resource:///modules/Interactions.jsm, line 209: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIUserIdleService.removeIdleObserver]
!!! error running onStopped callback: TypeError: callback is not a function
1637925810920   RemoteAgent     ERROR   unable to stop listener: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIWindowMediator.getEnumerator]"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: chrome://remote/content/cdp/observers/TargetObserver.jsm :: stop :: line 64"  data: no] Stack trace: stop()@TargetObserver.jsm:64
unwatchForTabs()@TargetList.jsm:70
unwatchForTargets()@TargetList.jsm:37
destructor()@TargetList.jsm:109
stop()@CDP.jsm:104
close()@RemoteAgent.jsm:138
1637926224227   geckodriver     INFO    Listening on 127.0.0.1:59093
1637926224231   mozrunner::runner       INFO    Running command: "/bin/firefox" "--marionette" "--remote-debugging-port" "47588" "-no-remote" "-profile" "/tmp/rust_mozprofile0dbwCJ"
Running without a11y support!
1637926224615   Marionette      INFO    Marionette enabled
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at /tmp/rust_mozprofile0dbwCJ/search.json.mozlz4", (void 0)))
DevTools listening on ws://localhost:47588/devtools/browser/55789d37-fad9-4600-92d4-582adfe86781
1637926227215   Marionette      INFO    Listening on port 33191
1637926227505   RemoteAgent     WARN    TLS certificate errors will be ignored for this session
1637926238888   Marionette      INFO    Stopped listening on port 33191
JavaScript error: chrome://global/content/elements/browser-custom-element.js, line 1671: NotFoundError: No such JSWindowActor 'MarionetteEvents'
JavaScript error: resource:///modules/Interactions.jsm, line 209: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIUserIdleService.removeIdleObserver]
!!! error running onStopped callback: TypeError: callback is not a function
1637926239699   RemoteAgent     ERROR   unable to stop listener: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIWindowMediator.getEnumerator]"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: chrome://remote/content/cdp/observers/TargetObserver.jsm :: stop :: line 64"  data: no] Stack trace: stop()@TargetObserver.jsm:64
unwatchForTabs()@TargetList.jsm:70
unwatchForTargets()@TargetList.jsm:37
destructor()@TargetList.jsm:109
stop()@CDP.jsm:104
close()@RemoteAgent.jsm:138

I tried this only on Centos 7 and 8. One on a physical machine, the other on an AWS machine.

I created a clean venv with the following packages:

async-generator==1.10
attrs==21.2.0
certifi==2021.10.8
cffi==1.15.0
chardet==4.0.0
charset-normalizer==2.0.7
click==8.0.3
cryptography==36.0.0
decorator==5.1.0
fake-useragent==0.1.11
Flask==2.0.2
h11==0.12.0
idna==3.3
itsdangerous==2.0.1
Jinja2==3.0.3
MarkupSafe==2.0.1
outcome==1.1.0
pdfminer.six==20200517
pdfplumber==0.5.28
Pillow==8.4.0
pycparser==2.21
pycryptodome==3.11.0
pyOpenSSL==21.0.0
requests==2.26.0
selenium==4.1.0
six==1.16.0
sniffio==1.2.0
sortedcontainers==2.4.0
trio==0.19.0
trio-websocket==0.9.2
urllib3==1.26.7
validators==0.18.2
Wand==0.6.7
Werkzeug==2.0.2
wsproto==1.0.0

Using latest geckodriver copied in venv/bin firefox.x86_64 91.3.0-1.el7.centos Python 3.8.12

How can we reproduce the issue?

I think I provided all the details above for creating a test environment.

Relevant log output

See above

Operating System

Centos 7 / Centos 8

Selenium version

4.0.0r2 and above - works on 4.0.0r1

What are the browser(s) and version(s) where you see this issue?

Firefox 90 and above

What are the browser driver(s) and version(s) where you see this issue?

0.30.0

Are you using Selenium Grid?

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Guys, I’m an idiot. For some reason, the error seemed to come from the geckodriver but it was actually from the chromedriver! I am starting up a service that opens up one firefox session and another chrome session and then I send commands to both browsers.

Anyway, the issue was from initialising chrome driver with the following parameters:

options.platform_name = "WINDOWS"
options.platform_version = "10"

Opening up chrome driver in 4.0.0rc2 and above with the above options will make chrome fail with the error code mentioned in this issue.

Thanks for the guidance in debugging this problem. Closing this issue.