Reputation: 2082
I have the following installed:
There is a sample test called "Example 0" from the official Selenium Python site: https://pypi.python.org/pypi/selenium. This is the entire test:
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://seleniumhq.org/')
When I run it, it complains "selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
"
Searching Stack Overflow for a solution, I find other suggested solutions, like this test:
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('C:\\Program Files\\Mozilla Firefox\\firefox.exe')
cap = DesiredCapabilities().FIREFOX
cap["marionette"] = False
browser = webdriver.Firefox(capabilities=cap, firefox_binary=binary)
browser.get('http://google.com/')
Running that, I get the following error:
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Possible firefox version mismatch. You must use GeckoDriver instead for Firefox 48+. Profile Dir: C:\Users\Username\AppData\Local\Temp\tmp4t_plvms If you specified a log_file in the FirefoxBinary constructor, check it for details.
I have Firefox v59, so the error says I should use GeckoDriver. Problem is, the first test above ("Example 0") used the GeckoDriver, and that had the "Unable to find a matching set of capabilities" error. The proposed solution to that error is to set "cap["marionette"] = False
" in the second test, but that approach fails.
I just can't win. How can I resolve this? I'd like to successfully run the "Example 0" test from the official Selenium Python site.
(P.S. this is not a duplicate question. All other similar questions have Firefox v54 or earlier, and are able to use the "marionette = False" approach. I'm using Firefox 59 and can't use that approach.)
Upvotes: 1
Views: 1153
Reputation: 2082
Turns out, I had Firefox 64-bit, Python 3.6 32-bit, and GeckoDriver 32-bit.
Upvotes: 2