selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities with Firefox 46 through Selenium
As you are using Selenium 3.8.0 you have to use GeckoDriver as a mandatory. But again as you are using Firefox v46.0 you have to set the capability marionette as False
through DesiredCapabilities()
as follows :
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
cap = DesiredCapabilities().FIREFOX
cap["marionette"] = False
browser = webdriver.Firefox(capabilities=cap, executable_path="C:\\path\\to\\geckodriver.exe")
browser.get('http://google.com/')
browser.quit()
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
I brew installed firefox and then it worked
Message: Unable to find a matching set of capabilities error using Selenium and GeckoDriver while loading on live server
This error message...
Message: Unable to find a matching set of capabilities
...implies that the GeckoDriver was unable to initiate/spawn a new Browsing Context i.e. Firefox Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
- Your Selenium Client version is 3.8.0 which is almost 2.5 years older.
- Your JDK version is unknown to us.
- Your GeckoDriver version is 0.18.0 which is older.
- Your Firefox version is 53 which is also pretty old.
So there is a clear mismatch between the Selenium Client v3.8.0 , GeckoDriver v0.18.0 and the Firefox Browser v53
Solution
Ensure that:
- JDK is upgraded to current levels JDK 8u251.
- Selenium is upgraded to current levels Version 3.141.59.
- GeckoDriver is upgraded to GeckoDriver v0.26.0 level.
- Firefox is upgraded to current Firefox v72.0 levels.
- GeckoDriver is present in the desired location.
- GeckoDriver is having executable permission for non-root users.
- Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
- If your base Web Client version is too old, then uninstall it install a recent GA and released version of Web Client.
- Take a System Reboot.
- Execute your
Test
as a non-root user. - Always invoke
driver.quit()
withintearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.
References
You can find a couple of relevant discussions in:
- Selenium “Unable to find a matching set of capabilities” despite driver being in /usr/local/bin
- selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities with Firefox 46 through Selenium
- Selenium WebDriver, Firefox, Centos, unable to find a matching set of capabilities
- Unable to find a matching set of capabilities with selenium 3.4.3, firefox 54.0 and gecko driver 0.17
- selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities with GeckoDriver, Selenium and Firefox
Related Topics
What Is the Most Efficient Way of Counting Occurrences in Pandas
Use of True, False, and None as Return Values in Python Functions
Python Django Global Variables
Finding First and Last Index of Some Value in a List in Python
Understanding Time.Perf_Counter() and Time.Process_Time()
Is the += Operator Thread-Safe in Python
Django Model "Doesn't Declare an Explicit App_Label"
Python: Urllib2 How to Send Cookie with Urlopen Request
Reset Color Cycle in Matplotlib
How to "Zip Sort" Parallel Numpy Arrays
How to Call Python Code from C Code
Mixed Slashes with Os.Path.Join on Windows
How to Make a Python Script Executable
How to Tell a Python Script to Use a Particular Version
Why Does Map Return a Map Object Instead of a List in Python 3
Python: Sorting Items from Top Left to Bottom Right with Opencv