Selenium “Unable to find a matching set of capabilities” despite driver being in /usr/local/bin

Solution 1:

This error message...

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

...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowsing Session i.e. Firefox Browser session.

Your main issue may be the incompatibility between the version of the binaries you are using as follows:

Solution

  • Upgrade Selenium to current levels Version 3.141.59.
  • Upgrade GeckoDriver to GeckoDriver v0.23.0 level.
  • Ensure GeckoDriver is present in the specified location.
  • Ensure GeckoDriver is having executable permission for non-root users.
  • Upgrade Firefox version to Firefox v64.0. levels.
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • (WindowsOS only) Use CCleaner tool to wipe off all the OS chores before and after the execution of your Test Suite.
  • (LinuxOS only) Free Up and Release the Unused/Cached Memory in Ubuntu/Linux Mint before and after the execution of your Test Suite.
  • If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
  • Take a System Reboot.
  • Pass the argument executable_path along with the absolute path of the GeckoDriver while initiating the WebDriver/WebBrowser session as follows:

    • Windows OS format:

      driver = webdriver.Firefox(executable_path=r'C:\path\to\geckodriver.exe')
      
    • Linux and MAC OS X format:

      driver = webdriver.Firefox(executable_path='/path/to/geckodriver')
      
  • Execute your Test as a non-root user.

  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.