Search code examples
pythonseleniumfirefoxredhatgeckodriver

Selenium Webdriver + geckodriver + python 2.6.6 + Firefox on RedHat 6.8 fails to open browser


I am having issues with successfully launching a Firefox Browser using the Selenium Webdriver for python. I have the following setup parameters:

Selenium Webdriver 3.4.3
Python 2.6.6
geckodriver-v0.18.0-linux64.tar.gz
firefox-45.0.1.1.el6.x86_64

Now, the geckodriver file is unzipped and is currently in /usr/local/bin directory with rwx all the way across:

rwxrwxrwx. 1 root root 7129173 Jul 26 14:42 geckodriver

I have updated the .bash_profile to include the path as:

PATH=$PATH:$HOME/bin:/usr/local/bin/geckodriver

The script that I am using is from the readme within the Selenium-3.4.3 directory "README.rst".

Scriptname: first_selenium_script.py

from selenium import webdriver

browser = webdriver.Firefox()
browser.get('http://seleniumhq.org/')

So, the results are as follows,

Traceback (most recent call last):
  File "first_selenium_script.py", line 3, in <module>
    browser = webdriver.Firefox()
  File "/usr/lib/python2.6/site-   packages/selenium-3.4.3-py2.6.egg/selenium/webdriver/firefox/webdriver.py",   line 152, in __init__
keep_alive=True)
  File "/usr/lib/python2.6/site- packages/selenium-3.4.3-py2.6.egg/selenium/webdriver/remote/webdriver.py", line 98, in __init__
self.start_session(desired_capabilities, browser_profile)
  File "/usr/lib/python2.6/site- packages/selenium-3.4.3-py2.6.egg/selenium/webdriver/remote/webdriver.py", line 188, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/lib/python2.6/site- packages/selenium-3.4.3-py2.6.egg/selenium/webdriver/remote/webdriver.py", line 256, in execute
self.error_handler.check_response(response)
  File "/usr/lib/python2.6/site-packages/selenium-3.4.3-py2.6.egg/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Unable to find a  matching set of capabilities

Any thoughts please . . . Thanks.


Solution

  • After doing some research, I am almost positive that my comment is correct - a version incompatibility between FireFox 45 and geckodriver 0.18. According to the geckodriver page:

    v0.18.0

    geckodriver now recommends Firefox 53 and greater

    It looks like FireFox 45 may be incompatible with geckodriver. Geckodriver was initially released on Apr 9, 2015, and Firefox 45 was released on March 8, 2015.

    So while there might be some chance of getting it to work on an old geckodriver, the best option would really be to update FireFox to >= v53.