1

This is the code I am using

from selenium import webdriver

url = "https://www.reddit.com/r/memes"
browser = webdriver.Firefox()
browser.get(url)

This is the error

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    browser = webdriver.Firefox()
  File "/home/jiahong/python/scrapping/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py", line 170, in __init__
    RemoteWebDriver.__init__(
  File "/home/jiahong/python/scrapping/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/jiahong/python/scrapping/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/jiahong/python/scrapping/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/jiahong/python/scrapping/lib/python3.8/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

I am using WSL with Ubuntu and I am using Vim. I do not get this error however if I am outside of WSL and use VSC instead. But I want to code in Vim.

YJH16120
  • 419
  • 1
  • 4
  • 15
  • 1
    Does this answer your question? [Selenium “Unable to find a matching set of capabilities” despite driver being in /usr/local/bin](https://stackoverflow.com/questions/53953524/selenium-unable-to-find-a-matching-set-of-capabilities-despite-driver-being-in) – Humayun Ahmad Rajib Jul 18 '20 at 11:50
  • I tried all of the listed solutions, and It doesn't work. – YJH16120 Jul 18 '20 at 12:33

1 Answers1

0

In the code, you haven't mentioned the path to the geckodriver executable. Your code should look something like this:

from selenium import webdriver

url = "https://www.reddit.com/r/memes"
browser = webdriver.Firefox(f'/home/user/Downloads/geckodriver')
# Or in Windows the path would be 'C:\\Users\\username\\Downloads\\geckodriver.exe'
browser.get(url)

If you don't already have the driver, get it from here.

RushiSrinivas.K
  • 171
  • 2
  • 11