Skip Navigation

How do you start Selenium+Firefox on Linux using a custom Geckodriver and Firefox path?

from selenium import webdriver
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Options

options = Options()
options.binary_location = '/mnt/sdb1/firefox/'

driver = webdriver.Firefox(options = options, service=Service(executable_path = '/mnt/sdb1/root'))

driver.get('https://youtube.com')
driver.execute_script('alert(\'your favorite music is here\')')

I get the following error

Traceback (most recent call last):
  File "/mnt/sdb1/root/sele.py", line 8, in 
    driver = webdriver.Firefox(options = options, service=Service(executable_path = '/mnt/sdb1/root'))
  File "/usr/local/lib/python3.9/dist-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
    self.service.path = DriverFinder.get_path(self.service, options)
  File "/usr/local/lib/python3.9/dist-packages/selenium/webdriver/common/driver_finder.py", line 44, in get_path
    raise NoSuchDriverException(f"Unable to locate or obtain driver for {options.capabilities['browserName']}")
selenium.common.exceptions.NoSuchDriverException: Message: Unable to locate or obtain driver for firefox; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location
4

You're viewing a single thread.

4 comments