Selenium: Selenium 3.4.0 Unable to find matching capabilities

Created on 24 Apr 2017  ·  98Comments  ·  Source: SeleniumHQ/selenium

OS: Ubuntu
Selenium Version: 3.4.0
Browser: Firefox 45
Geckodriver: 0.16.0

Hi, After updating to Selenium 3.4.0 it can't start Firefox:

File "/root/venv/3.5/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 152, in __init__
    keep_alive=True)
  File "/root/venv/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/root/venv/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 185, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/root/venv/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 249, in execute
    self.error_handler.check_response(response)
  File "/root/venv/3.5/lib/python3.5/site-packages/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

--------
Using Firefox 45 due to click not working on newer versions (https://github.com/mozilla/geckodriver/issues/322)
--------

Most helpful comment

@AutomatedTester actually, for me it's exactly that, driver = webdriver.Firefox() issue.

#!/usr/bin/env python3

from selenium import webdriver

driver = webdriver.Firefox()
driver.get('https://google.com')
Traceback (most recent call last):
  File "test2.py", line 5, in <module>
    driver = webdriver.Firefox()
  File "/home/matjaz/env/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 152, in __init__
    keep_alive=True)
  File "/home/matjaz/env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/home/matjaz/env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 185, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/matjaz/env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 249, in execute
    self.error_handler.check_response(response)
  File "/home/matjaz/env/lib/python3.6/site-packages/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

All 98 comments

Can this be reproduced on the newest Firefox nightly build?
Firefox 45 isn't expected to work with the newest versions of selenium (3.4.0) and geckodriver (0.16.0). Support for geckodriver 0.16 is best in Firefox 52.0.3 and onwards.

see:
https://github.com/mozilla/geckodriver#supported-firefoxen

It seems to work ok (Selenium 3.40 + Geckodriver 0.16.0 + Firefox 53.0).

Even the issue with the click (https://github.com/mozilla/geckodriver/issues/322) seems to be working now.

Thanks for the advice.

I'm experiencing the same issue with

OS: arch linux
Python: 3.6
Selenium: 3.4.0
Geckodriver: 0.16.0
Firefox: 53.0

py.test failure

selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities

env/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py:194: WebDriverException

Same platform and stack as @Nagasaki45, same issue.

This bug will remain closed until we can get a high quality bug report. Me too comments don't really add value

@AutomatedTester I'd gladly help, but this is the only info I get. How can I gather more information about the issue?

Hi, I got the same error on my Windows 10 PC. I got rid of the error by installing firefox and reverting to previous geckodriver (geckodriver-v0.15.0-win64).

Unfortunately no one has given steps to reproduce. This is clearly more than just driver=webdriver.Firefox() issue.

We can't do anything until proper steps to reproduce are given as documented in Contributing.md

Selenium tree tests being run in Python 3.6.1 and are passing. I ran 4 to show session startup.

dburns in ~/development/selenium/py on master λ tox -c py/tox.ini -r -e py36-marionette -v
using tox.ini: /Users/dburns/development/selenium/py/tox.ini
using tox-2.3.1 from /usr/local/lib/python2.7/site-packages/tox/__init__.pyc
GLOB sdist-make: /Users/dburns/development/selenium/py/setup.py
  /Users/dburns/development/selenium/py$ /usr/local/opt/python/bin/python2.7 /Users/dburns/development/selenium/py/setup.py sdist --formats=zip --dist-dir /Users/dburns/development/selenium/py/.tox/dist >/Users/dburns/development/selenium/py/.tox/log/tox-0.log
py36-marionette recreate: /Users/dburns/development/selenium/py/.tox/py36-marionette
  /Users/dburns/development/selenium/py/.tox$ /usr/local/opt/python/bin/python2.7 -m virtualenv --python /usr/local/bin/python3.6 py36-marionette >/Users/dburns/development/selenium/py/.tox/py36-marionette/log/py36-marionette-0.log
py36-marionette installdeps: pytest==3.0.3, pytest-instafail==0.3.0, pytest-mock==1.5.0, pytest-xdist==1.15
  /Users/dburns/development/selenium/py$ /Users/dburns/development/selenium/py/.tox/py36-marionette/bin/pip install -v --no-index --find-links=../third_party/py pytest==3.0.3 pytest-instafail==0.3.0 pytest-mock==1.5.0 pytest-xdist==1.15 >/Users/dburns/development/selenium/py/.tox/py36-marionette/log/py36-marionette-1.log
py36-marionette inst: /Users/dburns/development/selenium/py/.tox/dist/selenium-3.4.0.zip
  /Users/dburns/development/selenium/py$ /Users/dburns/development/selenium/py/.tox/py36-marionette/bin/pip install -v --no-index --find-links=../third_party/py /Users/dburns/development/selenium/py/.tox/dist/selenium-3.4.0.zip >/Users/dburns/development/selenium/py/.tox/py36-marionette/log/py36-marionette-2.log
  /Users/dburns/development/selenium/py$ /Users/dburns/development/selenium/py/.tox/py36-marionette/bin/pip freeze >/Users/dburns/development/selenium/py/.tox/py36-marionette/log/py36-marionette-3.log
py36-marionette installed: apipkg==1.4,appdirs==1.4.3,execnet==1.4.1,packaging==16.8,py==1.4.32,pyparsing==2.2.0,pytest==3.0.3,pytest-instafail==0.3.0,pytest-mock==1.5.0,pytest-xdist==1.15.0,selenium==3.4.0,six==1.10.0
py36-marionette runtests: PYTHONHASHSEED='1420169364'
py36-marionette runtests: commands[0] | py.test -n=auto --driver=Marionette
  /Users/dburns/development/selenium/py$ /Users/dburns/development/selenium/py/.tox/py36-marionette/bin/py.test -n=auto --driver=Marionette
=================================================== test session starts ====================================================
platform darwin -- Python 3.6.1, pytest-3.0.3, py-1.4.32, pluggy-0.4.0
rootdir: /Users/dburns/development/selenium/py, inifile: setup.cfg
plugins: xdist-1.15.0, mock-1.5.0, instafail-0.3.0
gw0 [605] / gw1 [605] / gw2 [605] / gw3 [605]
scheduling tests via LoadScheduling
....^CERROR: KEYBOARDINTERRUPT

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
to show a full traceback on KeyboardInterrupt use --fulltrace
/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py:299: KeyboardInterrupt
================================================ 4 passed in 12.21 seconds =================================================
ERROR: keyboardinterrupt

@AutomatedTester actually, for me it's exactly that, driver = webdriver.Firefox() issue.

#!/usr/bin/env python3

from selenium import webdriver

driver = webdriver.Firefox()
driver.get('https://google.com')
Traceback (most recent call last):
  File "test2.py", line 5, in <module>
    driver = webdriver.Firefox()
  File "/home/matjaz/env/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 152, in __init__
    keep_alive=True)
  File "/home/matjaz/env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/home/matjaz/env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 185, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/matjaz/env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 249, in execute
    self.error_handler.check_response(response)
  File "/home/matjaz/env/lib/python3.6/site-packages/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

unforunately... no one in my team can reproduce this issue

@mfin with geckodriver 0.16 and firefox 53?

On Arch linux with:
python 3.6.1-1
firefox 53.0-1
geckodriver 0.16.0-1
python-selenium 3.4.0-1

@mfin's test produces the same result for me.

Traceback (most recent call last):
  File "./test.py", line 5, in <module>
    driver = webdriver.Firefox()
  File "/usr/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 152, in __init__
    keep_alive=True)
  File "/usr/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 185, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 249, in execute
    self.error_handler.check_response(response)
  File "/usr/lib/python3.6/site-packages/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

@lmtierney yes. @thewinduppirate interesting, this looks to be Arch specific.

If I add the capabilities suggested by @jrbenny35, I get this:

Traceback (most recent call last):
  File "test.py", line 8, in <module>
    driver = webdriver.Firefox(capabilities=caps)
  File "/home/matjaz/Playground/test/env/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 169, in __init__
    self.binary, timeout)
  File "/home/matjaz/Playground/test/env/lib/python3.6/site-packages/selenium/webdriver/firefox/extension_connection.py", line 52, in __init__
    self.binary.launch_browser(self.profile, timeout=timeout)
  File "/home/matjaz/Playground/test/env/lib/python3.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 73, in launch_browser
    self._wait_until_connectable(timeout=timeout)
  File "/home/matjaz/Playground/test/env/lib/python3.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 114, in _wait_until_connectable
    % (self.profile.path))
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Possible firefox version mismatch. You must use GeckoDriver instead for Firefox 48+. Profile Dir: /tmp/tmpvt157u03 If you specified a log_file in the FirefoxBinary constructor, check it for details.

@mfin That looks like an outdated firefox version error. That was my problem. I removed a line in my test and it was using FF47.

Same issue here, latest selenium, Firefox 53 (latest update today), geckodriver v0.16.0, MacOs (latest, updated)

Hi. I have the same issue with geckodriver v0.16.0, Firefox 52.0.2, Python 3.5.3 and selenium 3.4.0 on Fedora 25.

Same problem as @jricardo27:

>>> window.run_command('run_selenium')
11:23:09 DEBUG selenium.webdriver.remote.remote_connection:478             _request() POST http://127.0.0.1:1646/session {"capabilities": {"firstMatch": [], "alwaysMatch": {"acceptInsecureCerts": true, "browserName": "firefox"}}, "desiredCapabilities": {"acceptInsecureCerts": true, "browserName": "firefox"}}
11:23:10 DEBUG selenium.webdriver.remote.remote_connection:565             _request() Finished Request
Traceback (most recent call last):
  File "D:\Sublime Text 3 x64\sublime_plugin.py", line 818, in run_
    return self.run(edit)
  File "D:\Sublime Text 3 x64\Data\Packages\TestPlugin\Selenium.py", line 26, in run
    run_tests(self.view)
  File "D:\Sublime Text 3 x64\Data\Packages\TestPlugin\Selenium.py", line 19, in run_tests
    browser = webdriver.Firefox()
  File "C:\Python36\Lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 152, in __init__
    keep_alive=True)
  File "C:\Python36\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Python36\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 185, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Python36\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 249, in execute
    self.error_handler.check_response(response)
  File "C:\Python36\Lib\site-packages\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

Environment

Operating system and version:
Windows 10 Enterprise LTSB 64-bit EN
Python:
3.6.1
Selenium:
3.4.0
Firefox:
53.0 (64-bit)
geckodriver:
0.16.0

Thanks.

For users experiencing this problem on Linux, can you tell me the following things:

  • What's the firefox path i.e. the result of runing which firefox?
  • What's the result of running file on the output of the above? i.e. file $(which firefox).
  • Does the directory containing the firefox binary (after following any symlinks) contain an application.ini and platfom.ini file?
  • What's the contents of the above files?

I suspect that a short term workaround for the bug may be to pass in an explicit path to the Firefox binary, after following any symlinks, in the capabilities i.e. something like {moz:firefoxOptions: {binary: /usr/lib/firefox/firefox}.

@jgraham firefox is in /bin, which is linked to /usr/bin, no *.ini files there also.

matjaz ~ $ which firefox
/bin/firefox
matjaz ~ $ file /bin/firefox
/bin/firefox: POSIX shell script, ASCII text executable
matjaz ~ $ ls -lah /bin
lrwxrwxrwx 1 root root 7 mar 26 23:57 /bin -> usr/bin
matjaz ~ $ ls /usr/bin/*.ini
/bin/ls: cannot access '/usr/bin/*.ini': No such file or directory

For me:

% which firefox
/usr/bin/firefox
% file$(which firefox)
/usr/bin/firefox: POSIX shell script, ASCII text executable

No *.ini files either.

OK, so we didn't consider the possibility of the firefox executable being a shell script outside the firefox directory. As a short term workaround, if you look in that shell script you should be able to find the real binary path and use that as a capability when you launch geckodriver.

@jgraham Thanks for the info.

Firefox now launches correctly after amending the test

#!/usr/bin/env python3

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary('/usr/lib/firefox/firefox')
driver = webdriver.Firefox(firefox_binary=binary)
driver.get('https://google.com')

@jgraham yes, I'm confirming that this solves the issue.

Great! Thanks for the debugging information. I'll try to come up with a good solution for this and get a release of geckodriver out with it fixed.

Hi,

I've same issue with Python Selenium.

[=] FireFox:
52.1.0 - 64 bit
[=] Selenium:
3.4.0
[=] Python:
2.7.13
[=] OS:
Linux - (Kali 64 bit) - dist upgraded to latest version

output:
/usr/bin/python /root/Desktop/ashiyane/ashiyane-alimp5.py
Traceback (most recent call last):
File "/root/Desktop/ashiyane/ashiyane-alimp5.py", line 12, in
driver = webdriver.Firefox(firefox_binary=binary)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 152, in __init__
keep_alive=True)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 185, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 249, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/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

Process finished with exit code 1

please fix this issue :(

Thanks

I used technique below, and selenium is working now.

capabilities = webdriver.DesiredCapabilities().FIREFOX
capabilities["marionette"] = False
binary = FirefoxBinary(r'/usr/bin/firefox')
driver = webdriver.Firefox(firefox_binary=binary, capabilities=capabilities)

Reference (Idea):
http://seleniumsimplified.com/2017/03/changes-in-selenium-webdriver-3-1-0-3-2-0-3-3-0-and-3-3-1-for-java/

Thanks

geckodriver has been fixed (v0.16.1) and this issue is gone!

Yes, I was about to comment that we made a release to address this bug. Glad it helped :)

Hi,

Same issue for me , after upgrading to selenium 3.4, using Selenium Grid / Jenkins

Hub : Selenium Standalone Server V3.4.0
Node 1 : Selenium Standalone Server V3.4.0 - Win 7 - Selenium 3.4 - Firefox 53 (64 bit) - Geckodriver V16.1

It raised this error when i try to launch test with robotframework :

Parent suite setup failed:
KeyError: 'moz:firefoxOptions'

it Works perfectly locally and worked perfectly with V3.3.1 / FF 52 / selenium 3.3.1

I have those error in Node Log :

  • geckodriver::marionette INFO Starting browser \?\C:\Program Files\Mozilla Firefoxfirefox.exe with args ["-marionette"]

  • Executing: [delete session: 88be91e9-0535-4c5b-915c-b3fa60b52fbf])
    Marionette INFO New connections will no longer be accepted

Selenium Standalone Server seems to be unstable, have to restart it every couple hours ?!

Thank's.

I had the following problems as others with geckodriver 0.16.0 from this link: https://github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0.16.1-linux64.tar.gz ( it stays that this is 0.16.1 but binary says 0.16.0) to work with 0.16.0 I had to use Firefox 52 ESR -> https://www.mozilla.org/en-US/firefox/organizations/faq/ and then

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

def setUp(self):
        binary = FirefoxBinary('path-to-my-esr-firefox-binary/firefox/firefox-bin')
        self.browser = webdriver.Firefox(firefox_binary=binary)

I was experiencing the same issue.

I downloaded my geckogriver from: https://github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0.16.1-linux64.tar.gz (same as @krzysztofzuraw), but my binary did say it was version 0.16.1 (geckodriver --version).

$ ls -l $(which firefox)
lrwxrwxrwx 1 root root 25 Feb  1 13:44 /usr/bin/firefox -> `../lib/firefox/firefox.sh`

Arch: linux (ubuntu 14.04)
Python: 2.7.6
selenium: 3.4.0
firefox: 51.0.1

Running (either the commented code or) the normal code from:

from selenium import webdriver
#from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

#binary = FirefoxBinary('/usr/lib/firefox/firefox')
#driver = webdriver.Firefox(firefox_binary=binary)

driver = webdriver.Firefox()

driver.get("http://www.google.com")

print driver.title

driver.quit()

yields (at line 5 or 7)

Traceback (most recent call last):
  File "./reproduce.py", line 7, in <module>
    driver = webdriver.Firefox()
  File "/home/user/.virtualenvs/sales/local/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 152, in __init__
    keep_alive=True)
  File "/home/user/.virtualenvs/sales/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/home/user/.virtualenvs/sales/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 185, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/user/.virtualenvs/sales/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 249, in execute
    self.error_handler.check_response(response)
  File "/home/user/.virtualenvs/sales/local/lib/python2.7/site-packages/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

However, following @alimp5's suggestion, the following code worked:

from selenium import webdriver

caps = webdriver.DesiredCapabilities.FIREFOX
caps["marionette"] = False

driver = webdriver.Firefox(capabilities=caps)

driver.get("http://www.google.com")

print driver.title

driver.quit()

Here:
Arch: OSX ElCapitain 10.11.6
Python: 2.7.10
Selenium: 3.4.1
Firefox: 53.0 (64-bit)

Worked like a charm.

Exception in thread "main" org.openqa.selenium.WebDriverException: connection refused
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'KARTIK-PC', ip: '192.168.43.111', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
0: 0x489f6f -
1: 0x48ad59 -
2: 0x43a15d -
3: 0x440de2 -
4: 0x443f9a -
5: 0x41ddb1 -
6: 0x4091c7 -
7: 0x6bc939 -
8: 0x415a19 -
9: 0x6b6e43 -
10: 0x7798652d - BaseThreadInitThunk
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$22(ProtocolHandshake.java:365)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:368)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:159)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:137)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:191)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:108)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:104)
at NewPackage.WebDriverDemo.main(WebDriverDemo.java:14)

I have the same problem with Selenium 3.4.0 under Debian Jessie, OpenJDK 1.8 update 111, Firefox ESR 45.9.0 (cannot switch to Firefox ESR 52.1.0 because it's not available for armhf yet) :
http://stackoverflow.com/questions/43834782/selenium-firefox-driver-doesnt-seem-to-work-with-firefox-esr-under-debian-jessi

org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'A20-OLinuXino', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'arm', os.version: '3.4.103-00033-g9a1cd03-dirty', java.version: '1.8.0_111'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
0: 0xb6de95b3 - backtrace::backtrace::trace::h8166ac046b01de0f
1: 0xb6de9acb - backtrace::capture::Backtrace::new::hb5a725a088a2a2fc
2: 0xb6dab093 - geckodriver::marionette::MarionetteHandler::create_connection::h826627e00cb80122
3: 0xb6db30fb - >::handle_command::hea45c68e72b3846e
4: 0xb6da784f - webdriver::server::start::{{closure}}::h3085395b806d111c
5: 0xb6d79be3 - std::panicking::try::do_call::h86a6e0cb77ef092f
6: 0xb6f06157 - panic_unwind::__rust_maybe_catch_panic
at /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libpanic_unwind/lib.rs:98
7: 0xb6d8bc1f - >::call_box::h995a340dc6da2f87
8: 0xb6efff53 - alloc::boxed::{{impl}}::call_once<(),()>
at /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/liballoc/boxed.rs:624
- std::sys_common::thread::start_thread
at /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libstd/sys_common/thread.rs:21
- std::sys::imp::thread::{{impl}}::new::thread_start
at /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libstd/sys/unix/thread.rs:84
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$22(ProtocolHandshake.java:365)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:368)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:159)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:137)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:191)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:108)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:137)

How can I make it work? When I use Selenium 2.53.0, it doesn't work.

You can try this code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
driver.get("https://kambhd.aka.corp.amazon.com:8443/launcher")

elem = driver.find_element_by_id("AccountId")
print elem

I got the error when i used to open using the binary.
binary = FirefoxBinary('C:\Program Files (x86)\Mozilla Firefoxfirefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)
* selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities

However, if i remove the firefox_binary argument, it worked. So use it like the following.
driver = webdriver.Firefox()

Firefox 45.9.0

driver = webdriver.Firefox()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 152, in __init__
    keep_alive=True)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 188, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/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

Operating system and version:
OSX 10.10.5
Java:
8
Selenium:
3.4.0
Firefox:
53.0.3 (64-bit)
geckodriver:
0.16.1

Code:
package basics;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class lunchbro {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.gecko.driver","/Users/anuj/Downloads/geckodriver");
WebDriver driver = new FirefoxDriver();
driver.get("http://google.com");
}
}

Getting below error:
1495337441832 geckodriver INFO Listening on 127.0.0.1:34375
1495337442089 geckodriver::marionette INFO Starting browser /Applications/Firefox.app/Contents/MacOS/firefox-bin with args ["-marionette"]
1495337443937 Marionette INFO Listening on port 49599
May 20, 2017 11:30:44 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
2017-05-20 23:30:44.477 plugin-container[437:13096] * CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x4e3f, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2017-05-20 23:30:44.478 plugin-container[437:13096] *
CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x8c43, name = 'com.apple.CFPasteboardClient'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2017-05-20 23:30:44.478 plugin-container[437:13096] Failed to allocate communication port for com.apple.CFPasteboardClient; this is likely due to sandbox restrictions

Solved for MacOS:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('/Applications/Firefox.app/Contents/MacOS/firefox-bin')
driver = webdriver.Firefox(executable_path = "/usr/local/bin/geckodriver")
driver.get("http://www.google.com")
print driver.title
driver.quit()

You had to use the Expected Firefox location from here: https://github.com/SeleniumHQ/selenium/wiki/FirefoxDriver

Good luck!

@HashBreakerPC I was getting the same error last night. Try out my code above and see if it works for you.

@JerryShih @aethanyc @moz-v2v-gh @xeonchen

Are we going to get a new geckodriver release addressing this issue? The Selenium-Python Tests keeps failing with geckodriver v0.16.1.

Thanks

3992 Is there a support or workaround for passing servlets param in grid file ?

Just anecdotal. I had a problem running my app so I tried it in Visual Studio (C# bindings) and it failed but when I stepped through it worked and then continued to work. Why? Not sure. Could be that Firefox has an initialization in the background or ??? as I said. Just anecdotal. Geckodriver 5/4/2017 Firebox 53. The problem started after I ran Firefox as after using Chrome for a while so maybe it triggered an auto-upgrade.

webdriver 3.4.0 geckodrover 16.0 firefox 52.0

Still gettin gthe error

Exception in thread "main" java.lang.IllegalStateException: The path to the
driver executable must be set by the webdriver.gecko.driver system
property; for more information, see https://github.com/mozilla/geckodriver.
The latest version can be downloaded from
https://github.com/mozilla/geckodriver/releases
at com.google.common.base.Preconditions.checkState(Preconditions.java:738)
at
org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124)
at
org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:41)
at
org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:115)
at
org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:330)
at
org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:108)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:104)
at SeleniumTask.main(SeleniumTask.java:13)

On Wed, May 31, 2017 at 2:15 AM, Bob Frankston notifications@github.com
wrote:

Just anecdotal. I had a problem running my app so I tried it in Visual
Studio (C# bindings) and it failed but when I stepped through it worked and
then continued to work. Why? Not sure. Could be that Firefox has an
initialization in the background or ??? as I said. Just anecdotal.
Geckodriver 5/4/2017 Firebox 53. The problem started after I ran Firefox as
after using Chrome for a while so maybe it triggered an auto-upgrade.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/SeleniumHQ/selenium/issues/3884#issuecomment-305002803,
or mute the thread
https://github.com/notifications/unsubscribe-auth/Aa8uFy1o7bkAFGNdL98HyZfCo63BakNFks5r_H_7gaJpZM4NFliF
.

Maybe you should Chrome. I use Google Chrome with chromedriver. It's fine
driver = webdriver.Chrome()

I think the issue would be mismatch between the geckodriver (32/64) and the firefox. that was it for me and making sure both are of the same bit type (32/64) worked for me.

selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities
I am getting the same issue
with firefox 54.0, selenium 3.4.3, gecko driver .17 and python 2.7

if __name__ == '__main__':
driver=webdriver.Firefox(executable_path=r'/home/saurabh/Saurabh/LearnPython/Automation/geckodriver');

Traceback (most recent call last):
File "/home/saurabh/Saurabh/LearnPython/Automation/Demo.py", line 5, in
driver=webdriver.Firefox(executable_path=r'/home/saurabh/Saurabh/LearnPython/Automation/geckodriver');
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 152, in __init__
keep_alive=True)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 188, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 256, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/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

I'm found something strange. This bug is reproducing for me when I'm call test suite from Cron but when I'm call test suite from terminal it's work normal. I'm found in node log that java RemoteDriver called from cron add to my capability "acceptInsecureCerts=true" and when this option is on then the suite crash. I've use single node with new driver and correct Firefox version.

org.openqa.selenium.WebDriverException: Build info: version: 'unknown', revision: 'unknown', time: 'unknown'

Same issue on a Raspberry PI Zero W. Latest Firefox-esr, latest Selenium, self compiled geckodriver from latest source 1.7.

Any hint? I tried the suggestions but the problem remains.

@speusippo If you switch to Debian Stretch (or any distribution based on it), you'll be able to use Firefox ESR 52, it should work.

selenium 3.4.3
firefox 54.0.1
python 2.7.13
geckodriver 0.16.0 0.17.0

same issue

Issue doesn't occur under geckodriver 0.18 (32-bits) firefox 45.1.1 32-bits if using selenium<3.4 (as today, 3.3.3)

selenium 3.4 , geckodriver-v0.18.0-win64
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities

For above error i just put below code and it works for me: (use your geckodriver.exe path in first line)

System.setProperty("webdriver.gecko.driver", "F:\\geckodriver-v0.18.0-win64\\geckodriver.exe");
    DesiredCapabilities capabilities=DesiredCapabilities.firefox();
    capabilities.setCapability("marionette", false);
    WebDriver driver = new FirefoxDriver(capabilities);
    driver.get("https://www.google.co.in");

I have the same problem:
MacOS
geckodriver 0.18
firefox v.54.0.1
selenium 3.4.3
python 3.6 and 2.7 also

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/case.py", line 597, in run
    self.setUp()
  File "/Users/mary/Documents/Python_testing/HRM/HRM_Tests/login.py", line 10, in setUp
    self.driver = webdriver.Firefox()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 152, in __init__
    keep_alive=True)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 188, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 256, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/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

One more data point-
FreeBSD 10.3-RELEASE-p20, python 2.7, selenium 3.4.3-py2
geckodriver 0.17.0 /usr/local/bin/geckodriver
Firefox 54.0.1 /usr/local/bin/firefox symlink to /usr/local/lib/firefox/firefox (executable file)
(/usr/local/bin is on the PATH)
test systems is headless (via ssh sessions), so there is no X display for firefox to hang on to; I'll try this again later with X running

cpz@kilrush:/mnt/users/cpz/webtesting % python2.7
Python 2.7.13 (default, Jul 13 2017, 01:14:26)
[GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd10
Type "help", "copyright", "credits" or "license" for more information.

from selenium import webdriver
browser = webdriver.Firefox()
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 152, in __init__
keep_alive=True)
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 188, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 256, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/site-packages/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

This does start a geckodriver instance.

as suggested above does not work for me

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary=FirefoxBinary('/usr/local/lib/firefox/firefox')
browser = webdriver.Firefox(executable_path="/usr/local/bin/geckodriver")
(same error)

For web developers. I have an using below code:

/**
   * Click on the element with the provided CSS Selector.
   *
   * @When /^I click on the element with css selector "([^"]*)"$/
   */
  public function iClickOnTheElementWithCSSSelector($cssSelector) {
    $session = $this->getSession();
    $element = $session->getPage()->find(
      'xpath',
      // Just changed xpath to css.
      $session->getSelectorsHandler()->selectorToXpath('css', $cssSelector)
    );
    if (NULL === $element) {
      throw new \InvalidArgumentException(sprintf('Could not evaluate CSS Selector: "%s"', $cssSelector));
    }

    //$element->click();
    $session->executeScript("jQuery('".$cssSelector."').click()");
  }

I also have an issue with "Unable to find a matching set of capabilities"
OS: WIndows 10
Selenium:3.4.0
Gecko: 0.18.0

I'm also having this issue.. Was anyone able to find a working fix?
Freebsd 10.3-RELEASE-p18
geckodriver 0.17.0
selenium==3.4.3
Mozilla Firefox 54.0.1

Error:
selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities

I had this error, and updated my firefox and left it open. Now its working.

I was having this issue with the 3.5.0 Grid update:
geckodriver 0.18
selenium grid 3.5.0
client-combined-3.5.0-nodeps.jar
firefox 54.0.1

In java:
Fixed by doing the following for my RemoteWebDriver:

System.setProperty("webdriver.gecko.driver", WebDriverUtils.getProperty("webdriver.gecko.driver"));
FirefoxOptions ffoptions = new FirefoxOptions();
String version = WebDriverUtils.getProperty("browser.version");
capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(CapabilityType.BROWSER_VERSION, version);
ffoptions.setBinary(new File(WebDriverUtils.getProperty("webdriver.firefox.bin")).getAbsolutePath());
capabilities.setCapability("firefox_binary", WebDriverUtils.getProperty("webdriver.firefox.bin"));
capabilities.setCapability(FirefoxOptions.FIREFOX_OPTIONS, ffoptions);
return new RemoteWebDriver(new URL(hubAddress), capabilities);

And for local tests:

System.setProperty("webdriver.gecko.driver", WebDriverUtils.getProperty("webdriver.gecko.driver"));
FirefoxOptions options = new FirefoxOptions();
options.setBinary(new File(WebDriverUtils.getProperty("webdriver.firefox.bin")).getAbsolutePath());
return new FirefoxDriver(options);

@sgtjim Please provide a reproduction screnario instead of description of a workaround.

@barancev

this code here causes the issue mentioned in this thread:

System.setProperty("webdriver.gecko.driver", WebDriverUtils.getProperty("webdriver.gecko.driver"));
String version = WebDriverUtils.getProperty("browser.version");
capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(CapabilityType.BROWSER_VERSION, version);
capabilities.setCapability("firefox_binary", WebDriverUtils.getProperty("webdriver.firefox.bin"));
return new RemoteWebDriver(new URL(hubAddress), capabilities);

org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities
Build info: version: '3.5.0', revision: '8def36e068', time: '2017-08-10T23:00:22.093Z'
System info: host: '<removed>', ip: '<removed>', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_141'
Driver info: driver.version: unknown
remote stacktrace: stack backtrace:
   0:           0x4bb74f - <no info>
   1:           0x4bbea9 - <no info>
   2:           0x43df94 - <no info>
   3:           0x447acf - <no info>
   4:           0x4203e1 - <no info>
   5:           0x407dc7 - <no info>
   6:           0x6d95b9 - <no info>
   7:           0x4173a7 - <no info>
   8:           0x6d38b3 - <no info>
   9:     0x7ffb5e598102 - BaseThreadInitThunk
Command duration or timeout: 918 milliseconds
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
    at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
    at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
    at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:360)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
    at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:363)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:137)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:254)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:174)

..adding in lines to put FirefoxOptions into the capabilities seems to fix this issue:

//Location of geckodriver.exe
System.setProperty("webdriver.gecko.driver", WebDriverUtils.getProperty("webdriver.gecko.driver"));
FirefoxOptions ffoptions = new FirefoxOptions();
//User specified version of firefox to use (e.g. 54.0.1)
String version = WebDriverUtils.getProperty("browser.version");
capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(CapabilityType.BROWSER_VERSION, version);
//location of Firefox version .exe file
ffoptions.setBinary(new File(WebDriverUtils.getProperty("webdriver.firefox.bin")).getAbsolutePath());
capabilities.setCapability("firefox_binary", WebDriverUtils.getProperty("webdriver.firefox.bin"));
capabilities.setCapability(FirefoxOptions.FIREFOX_OPTIONS, ffoptions);
return new RemoteWebDriver(new URL(hubAddress), capabilities);

... that means a configuration issue, Selenium found too old browser version and could not run it normally. Providing path to a more recent browser version fixed the issue.

@barancev Is there a difference on the backend between:

capabilities.setCapability("firefox_binary", WebDriverUtils.getProperty("webdriver.firefox.bin")); //a coded path to firefox.exe

and

ffoptions.setBinary(new File(WebDriverUtils.getProperty("webdriver.firefox.bin")).getAbsolutePath());

..which sets the path to the same thing that we have hardcoded?
when i print both to the console, the path to both shows up as:
D:commonfirefoxfirefox.exe

Yes, it's not recommended to set capabilities directly. Prefer FirefoxOptions that generates valid payload for the request that starts a new session.

... and read about passthrough mode in the changes description: https://github.com/SeleniumHQ/selenium/blob/master/java/CHANGELOG
I bet setting it to false may resolve the issue too, but it can block some new features.
A better solution is migration to use of FirefoxOptions to generate valid payload.

System: Windows 7 SP 1
Selenium: 3.5.0 (Python bindings) (latest current version 08-2017)
Python: 3.6.2 (latest current version since 08-2017)
GeckoDriver: 0.18.0 (latest current version since 08-2017)
Firefox: 55.0.1 (latest current version since 08-2017)

@AutomatedTester so how to get the more details information you needed? What is a 'high quality bug report'? I like to help you guys, but please say what you needed and how do I get it.

I just do (after adding WebDriver to the path):

from selenium import webdriver
driver = webdriver.Firefox()

Nothing wrong with that, right?

Python traceback:

Traceback (most recent call last):
  File "my_special_code.py", line 26, in __init__
    driver = webdriver.Firefox()
  File "....\site-packages\selenium\webdriver\firefox\webdriver.py", line 154, in __init__
    keep_alive=True)
  File "....\site-packages\selenium\webdriver\remote\webdriver.py", line 140, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "....\site-packages\selenium\webdriver\remote\webdriver.py", line 229, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "....\site-packages\selenium\webdriver\remote\webdriver.py", line 297, in execute
    self.error_handler.check_response(response)
  File "....\site-packages\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

geckodriver.log:

1502891151420   geckodriver INFO    geckodriver 0.18.0
1502891151433   geckodriver INFO    Listening on 127.0.0.1:50247

What to do now? It doesn't work.. :(

@danger89 Is this the complete content of geckodriver.log? The next line should be like
1502893059721 geckodriver::marionette INFO Starting browser C:\Program Files\Mozilla Firefox\firefox.exe with args ["-marionette"]

I can reproduce the issue if geckodriver attempts to start Firefox ESR 52. Yes, the error message is misleading in this case, but it's a diferent issue.

Try to specify path to the browser explicitly:
driver = webdriver.Firefox(firefox_binary="C:/Program Files/Mozilla Firefox/firefox.exe")

@barancev Yes this is actually the full log. I also think the logging and error tracing can be improved, both at Mozilla as well as Selenium.

EDIT:
AHA!!! I JUST FOUND IT DAM*. Since I can program all languages, I just switch from Python to Java (since Selenium RC is also Java, I thought maybe Java client is better in displaying the root cause ><).

System.setProperty("webdriver.gecko.driver", "C:\\LOCATION\\TO\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();

Which gave me:
Exception in thread "main" org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed.

Well OK, so I did install Firefox, but not on the default location. So that is probably the cause. I check in Java how to set it manually. So the code end up looking like:

System.setProperty("webdriver.gecko.driver", "C:\\LOCATION\\TO\\geckodriver.exe");
FirefoxOptions options = new FirefoxOptions();
options.setBinary("C:\\OTHER\\LOCATION\\Mozilla Firefox\\firefox.exe"); 
WebDriver driver = new FirefoxDriver(options);

And that worked!
The same is possible via the Python client I hope..?

But indeed the error exception in Python is very very inaccurate, confusing and not helpful at all.
Selenium should raise some custom Exception("Firefox can not be found") or something... So I can create a better script which is more robust.

@danger89 Try to specify path to the browser explicitly:
WebDriver driver = new FirefoxDriver(new FirefoxOptions().setBinary("C:/Program Files/Mozilla Firefox/firefox.exe"));

UPDATE: I see you've found this option. And what's the result? I can't reproduce the issue with "empty geckodriver log" on FF 55+.

@barancev , that is what I did right? But thanks anyway for helping.

options.setBinary("C:\\OTHER\\LOCATION\\Mozilla Firefox\\firefox.exe"); 

But now let's try this in Python..

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary('C:\some\location\firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)

I think I just will create a new issue regarding better error logging atleast in the Python bindings.

SOLVED FOR UBUNTU 16.0

~ Firefox 56.0
Here in command line:
sudo apt-get install firefox

~ Selenium 3.4.0
Here in command line (you should to install before "pip", its really easy):
pip install selenium==3.4.0

~ Gekodriver 16.0
Here, search version 16.0-linux64:
https://github.com/mozilla/geckodriver/releases

                                                                                                                                                                                                                                                                                                                                                                                                                          Sent from my BlackBerry 10 smartphone.                                                                                                                                                                                                                From: Pavel HrdinaSent: Friday 20 October 2017 15:36To: SeleniumHQ/seleniumReply To: SeleniumHQ/seleniumCc: SubscribedSubject: Re: [SeleniumHQ/selenium] Selenium 3.4.0 Unable to find matching capabilities (#3884)Hey guys, just ran into this, but slightly different case:

I user Docker version of selenium in version 3.5 and I get this:
WebDriverException: Message: W3C payload contained keys that do not comply with the spec: [chromeOptions, platform, version]
Stacktrace:
at org.openqa.selenium.remote.server.NewSessionPayload.validateSpecCompliance (NewSessionPayload.java:179)
at org.openqa.selenium.remote.server.NewSessionPayload.validate (NewSessionPayload.java:157)
at org.openqa.selenium.remote.server.NewSessionPayload. (NewSessionPayload.java:146)
at org.openqa.selenium.remote.server.BeginSession.execute (BeginSession.java:66)
at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$0 (WebDriverServlet.java:231)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)

PIece of code that causes that in my codestack (the exception happends on the last line):
opts = Options()
opts.add_argument("user-agent={}".format(self.mobile_user_agent))

self.browser = webdriver.Remote(command_executor="http://selenium:4444/wd/hub", desired_capabilities=opts.to_capabilities())
I guess you guys updated version of Chrome and the option are just wrong. Can you please show me the right direction?

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/SeleniumHQ/selenium","title":"SeleniumHQ/selenium","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/SeleniumHQ/selenium"}},"updates":{"snippets":[{"icon":"PERSON","message":"@grafa in #3884: Hey guys, just ran into this, but slightly different case:\r\n\r\nI user Docker version of selenium in version 3.5 and I get this:\r\n\r\n\r\nWebDriverException: Message: W3C payload contained keys that do not comply with the spec: [chromeOptions, platform, version]\r\nStacktrace:\r\n at org.openqa.selenium.remote.server.NewSessionPayload.validateSpecCompliance (NewSessionPayload.java:179)\r\n at org.openqa.selenium.remote.server.NewSessionPayload.validate (NewSessionPayload.java:157)\r\n at org.openqa.selenium.remote.server.NewSessionPayload.\u003cinit\u003e (NewSessionPayload.java:146)\r\n at org.openqa.selenium.remote.server.BeginSession.execute (BeginSession.java:66)\r\n at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$0 (WebDriverServlet.java:231)\r\n at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)\r\n at java.util.concurrent.FutureTask.run (FutureTask.java:266)\r\n at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)\r\n at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)\r\n at java.lang.Thread.run (Thread.java:748)\r\n\r\n\r\nPIece of code that causes that in my codestack (the exception happends on the last line):\r\npython\r\nopts = Options()\r\nopts.add_argument(\"user-agent={}\".format(self.mobile_user_agent))\r\n\r\nself.browser = webdriver.Remote(command_executor=\"http://selenium:4444/wd/hub\", desired_capabilities=opts.to_capabilities())\r\n\r\n\r\nI guess you guys updated version of Chrome and the option are just wrong. Can you please show me the right direction?"}],"action":{"name":"View Issue","url":"https://github.com/SeleniumHQ/selenium/issues/3884#issuecomment-338164396"}}}

I also faced similar issue "Unable to find matching capabilities", Soluiton was use following version
Selenium: 3.6.0.0
Firefox: 53.0
geckodriver: 16.1
This works fine for me on firefox

Thanks :)

on MAC os
I had also got into this and back to back into series of multiple issues
After trying multiple versions compatibility. This is what starts my app, can be useful.

Gecko: v0.19.0, Selenium: 3.6.0, Firefox: 55.0.3, 56.0
Gecko: v0.16.0, Selenium: 3.6.0, Firefox: 53.0.3 & 55.0.3 & 56.0

In my case this error was caused by non default firefox (aka portable firefox).
How did I fixed it:
instead of: driver = webdriver.Firefox()
use:

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary('c:\\ffx-path-here\\firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)

p.s. System: win64, selenium 3.8.0, firefox 57.0.1, geckodriver 0.19.1

am using win 8, 64 bit os, i installed python 27,robot frame work latest version, selenium2library latest version, geckodriver 0.16.0, i have run the suite but it's didnt run, i got a same issue. which is " cannot capture screenshot because the browser is not open" could you please anyone help to me.

oh yes... i had fixed that issue. thank you for good info.

In my case this error was also caused by portable firefox.

Portable firefox has PortableFirefox.exe in the root folder and when you try to run it with Selenium it just opens Firefox's browser and then you get this "Unable to find matching capabilities" error.

In order to fix this you need to replace the path to PortableFirefox.exe with the path to firefox.exe that is located somewhere further down in the directory of portable firefox. In my case it was located in App/Firefox/.

I.e. as far as I understand PortableFirefox.exe is just a some kind of wrapper for firefox.exe and should not be used with Selenium. Have no idea why it is not mentioned in the docs.

for the mac users only
I also went through this problem and solved it through this link https://amit2rockon.github.io/codesync/blog/2018/02/02/webdrivers.html

Mac user here. If it helps anyone I fixed this by making sure Firefox was named "Firefox" and in the Applications folder. I had the error when it was named "Firefox 58" (I have multiple versions).

It happened to me too, all I had to do was "apt install firefox"

Actually the GeckoDriver has been introduced for selenium versions greater than 3.0.So in our progrem,
when we write
System.setProperty("webdriver.gecko.driver","path to the webdriver");
webDriver driver=new FireFoxDriver();
It will launch the Firefox instance.Now problem here is that Selenium 3.0 and above supports Firefox versions 50 and above only .So if we are using old versions of firefox like 45 ,47 etc then our firefox will not launch though our code is correct.

same problem

selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities

geckodriver was installed via brew

geckodriver 0.20.1 is already installed and up-to-date

UPD. Solved!
Just install firefox:
brew install caskroom/cask /firefox

If you have Firefox 64-bits version, then download Gecko 64-bits version, same for 32-bits. This solved my problem.

For me, the cause of this problem was the incorrect binary path. I am using Firefox Developer Edition and the path of binary is /usr/bin/firefox-developer-edition on Arch Linux.
If someone steps on the same problem using Firefox Developer Edition, take care of the path.

Hello, I have the same issue with:

Python 3.7.0
Firefox 62.0
geckodriver-0.21.0
selenium 3.14.0 (from pypi)
FreeBSD 12

This code doesn't work:

from selenium import webdriver

driver = webdriver.Firefox()
Traceback (most recent call last):
  File "1.py", line 6, in <module>
    driver = webdriver.Firefox()
  File "/tmp/sel/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 167, in __init__
    keep_alive=True)
  File "/tmp/sel/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 156, in __init__
    self.start_session(capabilities, browser_profile)
  File "/tmp/sel/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 251, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/tmp/sel/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 320, in execute
    self.error_handler.check_response(response)
  File "/tmp/sel/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

while this does:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary('/usr/local/bin/firefox')
driver = webdriver.Firefox(firefox_binary=binary)
> which firefox
/usr/local/bin/firefox
> ls -l /usr/local/bin/firefox
lrwxr-xr-x  1 root  wheel  30 Sep  4 03:26 /usr/local/bin/firefox -> /usr/local/lib/firefox/firefox
 python3.6 fuck.py
Traceback (most recent call last):
  File "fuck.py", line 5, in <module>
    driver = webdriver.Firefox(firefox_binary=binary)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 162, in __init__
    keep_alive=True)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1


Same here I have spent now days on it. Should we again ditch BSD just because something does not work?!

Have same issue on windows as well, any suggestions? already gave FirefoxBinary

    binary = FirefoxBinary('C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe')
    driver = webdriver.Firefox(firefox_binary=binary)
    driver.maximize_window

WoW this Selenium dev community is a complete garbage, a lot of people complaining here and you even closed the ticket.

BTW on Fbsd 11 the real Firefox binary is at: /usr/local/lib/firefox/firefox

Not like it would help the situation fucking devfuks:

#!/usr/bin/env python3

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

capabilities = webdriver.DesiredCapabilities().FIREFOX
capabilities["marionette"] = False
binary = FirefoxBinary(r'/usr/local/lib/firefox/firefox')
driver = webdriver.Firefox(firefox_binary=binary, capabilities=capabilities)
driver.get('https://google.com')

Shit us back a god damn answer why is this motherfucking piece of shit doesnt work. We can't even proceed with our project because the basic fucking HELLOWORLD type program doesn't even fucking work.

Traceback (most recent call last):
  File "final2.py", line 9, in <module>
    driver = webdriver.Firefox(firefox_binary=binary, capabilities=capabilities)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 179, in __init__
    self.binary, timeout)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/firefox/extension_connection.py", line 52, in __init__
    self.binary.launch_browser(self.profile, timeout=timeout)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 73, in launch_browser
    self._wait_until_connectable(timeout=timeout)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 104, in _wait_until_connectable
    "The browser appears to have exited "
selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.

@daredevilbsd Keep calm, the issue was closed by its author (see https://github.com/SeleniumHQ/selenium/issues/3884#issuecomment-296517805), not a selenium team member. The author decided that his issue was resolved. And his issue was not related to FreeBSD.

Hijacking a bug report that is not related to your problem and was closed by the author more than a year ago looks suboptimal.

Guys download the firefox binary from here https://ftp.mozilla.org/pub/firefox/releases/46.0.1/
Then use the following code by assigning the binary path to the one you just downloaded:

capabilities = webdriver.DesiredCapabilities().FIREFOX
capabilities["marionette"] = False
binary = FirefoxBinary(r'PATH_TO/firefox-sdk/bin/Firefox.app/Contents/MacOS/firefox') //use the path leading to the binary here
fp = webdriver.FirefoxProfile()
driver = webdriver.Firefox(firefox_binary=binary,  firefox_profile=fp,capabilities=capabilities)

I was able to solve this by simply installing Firefox. Just having the webdriver alone isn't enough, you must have the desktop app as well.

I have firefox 64bit installed and was using gekodriver32bit resolved the issue by simply downloading gekodriver64bit

Ubuntu 16: "apt install firefox" did the trick.

Install latest firefox and install latest geckodriver fixed it

Was this page helpful?
0 / 5 - 0 ratings