selenium: Selenium 3.4.0 Unable to find matching capabilities

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) --------

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 7
  • Comments: 98 (13 by maintainers)

Commits related to this issue

Most upvoted comments

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

unforunately… no one in my team can reproduce this issue

@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

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()

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

@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')

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).

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

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

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.

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

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

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 - <no info> 1: 0x48ad59 - <no info> 2: 0x43a15d - <no info> 3: 0x440de2 - <no info> 4: 0x443f9a - <no info> 5: 0x41ddb1 - <no info> 6: 0x4091c7 - <no info> 7: 0x6bc939 - <no info> 8: 0x415a19 - <no info> 9: 0x6b6e43 - <no info> 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.<init>(RemoteWebDriver.java:137) at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:191) at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:108) at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:104) at NewPackage.WebDriverDemo.main(WebDriverDemo.java:14)

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.

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

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

Worked like a charm.

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.

Install latest firefox and install latest geckodriver fixed it

Ubuntu 16: “apt install firefox” did the trick.

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)

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.

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).

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

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 😃

@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")

… 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.

selenium 3.4.3 firefox 54.0.1 python 2.7.13 geckodriver 0.16.0 0.17.0

same issue

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.<init>(FirefoxDriver.java:108) at org.openqa.selenium.firefox.FirefoxDriver.<init>(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 .

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

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

@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

@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.

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

Same platform and stack as @Nagasaki45, same issue.

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.