keksik-lolz
keksik-lolz

Reputation: 21

why doesn't selenium work properly on manjaro (PATH problem)

i just downloaded selenium and wanted to try just simple code:

from selenium import webdriver

driver = webdriver.Firefox(executable_path='/usr/local/bin/geckodriver')
driver.get("https://www.youtube.com")

error:

Traceback (most recent call last):
  File "/home/keksik/JetBainz/PycharmProjects/pythonProject1/main.py", line 3, in <module>
    driver = webdriver.Firefox(executable_path='/usr/local/bin/geckodriver')
  File "/home/keksik/JetBainz/PycharmProjects/pythonProject1/venv/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py", line 170, in __init__
    RemoteWebDriver.__init__(
  File "/home/keksik/JetBainz/PycharmProjects/pythonProject1/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/keksik/JetBainz/PycharmProjects/pythonProject1/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/keksik/JetBainz/PycharmProjects/pythonProject1/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/keksik/JetBainz/PycharmProjects/pythonProject1/venv/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

it also doesn't work if i change

driver = webdriver.Firefox(executable_path='/usr/local/bin/geckodriver')

to

driver = webdriver.Firefox()

i made gecko driver executable with chmod +x geckodriver

moved it to usr/local/bin

and set path like that:

export PATH=$PATH:/usr/local/bin/geckodriver

still doesn't work

with webdriver-manager the error is

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

Upvotes: 1

Views: 1172

Answers (2)

Leidolf
Leidolf

Reputation: 837

Appearently, the issue occurs due to non-administrative privileges. The location where you have your driver at needs root privileges to be executed/run. I suggest you moving your driver to somewhere in your home directory where you don't need root privileges to launch the driver.

Upvotes: 1

theNishant
theNishant

Reputation: 665

You can always install the Firefox driver on the fly. Just make sure you have the normal version of firefox installed. This doesn't have any kind of dependency on your local setup.

All you need to do is:

self.driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())

from

from webdriver_manager.firefox import GeckoDriverManager

Upvotes: 0

Related Questions