1

To complete a project using Selenium, I first need to add Geckodriver to PATH. I have read many articles about adding elements to PATH, but none of them end up working (I follow the steps and add a new element to PATH, but when I run my program I get the 'geckodriver' executable needs to be in PATH error.

1: I first download this version of Geckodriver from here: https://github.com/mozilla/geckodriver/releases

2: I extract the folder and add it to the PATH

3: When I run my program, I get the same error Message: 'geckodriver' executable needs to be in PATH.

Any help would be appreciated!

hyperrr
  • 97
  • 1
  • 9
  • Does this answer your question? [Selenium using Python - Geckodriver executable needs to be in PATH](https://stackoverflow.com/questions/40208051/selenium-using-python-geckodriver-executable-needs-to-be-in-path) – Daniel Jan 04 '23 at 23:20
  • Can you post your code? – AbiSaran Jan 05 '23 at 02:29

2 Answers2

1

You do need to add an environment variable for the firefox driver. String exePath = ".\\lib\\geckodriver.exe"; System.setProperty("webdriver.gecko.driver", exePath); driver = new FirefoxDriver();

0

You don't have to add a new environment variable, just move the file geckodriver.exe to your python folder, which in my case is

C:\Users\username\AppData\Local\Programs\Python\Python310

Then to start the firefox driver just run

from selenium import webdriver
driver = webdriver.Firefox()
sound wave
  • 3,191
  • 3
  • 11
  • 29