'geckodriver' executable needs to be in PATH using GeckoDriver and Firefox through Selenium


I'm very familiar with using chromedriver for selenium, im now trying to using geckdriver instead but for some reason I keep getting the error 'geckodriver' executable needs to be in PATH.

I followed the steps in Selenium using Python - Geckodriver executable needs to be in PATH

  • I added gecko driver to path in environment variables

  • I updated firefox to the latest version

  • I used the binary method

  • Put the geckodriver in my folder where my script is

  • I restarted my computer

But none of these methods seem to work, is there something I'm missing?

Here's my code

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary("C:\\Users\\ojadi\\Downloads\\geckodriver-v0.28.0-win64\\geckodriver.exe")
browser = webdriver.Firefox(firefox_binary=binary)

You can download and store the GeckoDriver executable anywhere with in your system and you need to do pass the absolute path of firefox binary through the attribute binary_location as follows:

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

options = Options()
options.binary_location = r'C:\Program Files\Mozilla Firefox\firefox.exe'
driver = webdriver.Firefox(firefox_options=options, executable_path=r'C:\Users\\ojadi\Downloads\geckodriver-v0.28.0-win64\geckodriver.exe')

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at


Login to comment