You are not logged in.

#1 2018-11-01 02:20:50

Kolo
Member
Registered: 2018-10-28
Posts: 8

Selenium webdriver trouble with firefox

I've installed the latest versions of python-selenium, geckodriver, firefox and python. This is what I get:

[kolo@arch ~]$ sudo python
Python 3.7.1 (default, Oct 22 2018, 10:41:28) 
[GCC 8.2.1 20180831] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from selenium import webdriver
>>> browser = webdriver.Firefox()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
    keep_alive=True)
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities

>>> 

I found some information here and it seems someone had a similar problem where "firefox" was a shell script linking to the actual binary https://github.com/SeleniumHQ/selenium/issues/3884 . Thus I've tried specifying the path to the firefox binary as well as defining capabilities (running it as root with firefox closed), but that just leads to a different error:

>>> from selenium import webdriver
>>> capabilities = webdriver.DesiredCapabilities().FIREFOX
>>> capabilities["marionetter"] = False
>>> from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
>>> binary = FirefoxBinary('/usr/lib/firefox/firefox')
>>> driver = webdriver.Firefox(firefox_binary=binary, capabilities=capabilities)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
    keep_alive=True)
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process

>>> 

I get the exact same message if I skip all the capability steps, but I thought I'd include it as an example for something that doesn't work. Perhaps it's a simple matter of looking into this /usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py but unfortunately my knowledge of python is still very limited and there's not much advice I've found other than "upgrade your system".

Last edited by Kolo (2018-11-01 02:26:00)

Offline

Board footer

Powered by FluxBB