Selenium using Python – Geckodriver executable needs to be in PATH

Geckodriver executable needs to be in PATH

This is very common issue we normally encounter when we are trying to open FireFox using selenium. I was also victim of this issue in my Windows 10 operating system. My code was simple –

from selenium import webdriver
browser = webdriver.Firefox()

My error was like-
Selenium Issue

I have investigated a lot and many people suggesting to set environment variable PATH in control panel. But unfortunately that didn’t solved my issue. So, I directly refered geckodriver.exe file from its location and the solution worked for me.

from selenium import webdriver
browser = webdriver.Firefox(executable_path="C:\Python\Python37\Drivers\geckodriver\geckodriver.exe")


Now I am able to open firefox using selenium code. Please note that the same method is applicable for other browsers also.

Hope, it help to solve your issue. Please put your comments in below section.

One Reply to “Selenium using Python – Geckodriver executable needs to be in PATH”

Leave a Reply

Your email address will not be published. Required fields are marked *