Home > Enterprise >  Add geckodriver to PATH on Windows 11
Add geckodriver to PATH on Windows 11

Time:01-06

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:

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!

CodePudding user response:

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()

CodePudding user response:

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();

  • Related