Python Forum

Full Version: Getting error 'geckodriver' executable needs to be in PATH.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am executing the following python program, and getting error mentioned "'geckodriver' executable needs to be in PATH. "

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
assert "No result found." not in driver.page_source
/usr/bin/python2.7 /home/csurv_4/PycharmProjects/web_parsing/ Traceback (most recent call last): File "/home/csurv_4/PycharmProjects/web_parsing/", line 4, in <module> driver = webdriver.Firefox() File "/usr/lib/python2.7/site-packages/selenium/webdriver/firefox/", line 148, in __init__ self.service.start() File "/usr/lib/python2.7/site-packages/selenium/webdriver/common/", line 83, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. Process finished with exit code 1
I want to know that why the error is coming and what is the resolution of this error? Please explain.
I am using fedora operating system and pycharm editor.
Download the proper geckodriver depending upon your operating system and System Architecture from the url here - geckodriver

Now follow the below steps -
Extract the geckodriver file from the downloaded zip file. Now depending upon your operating system do the following.

For Linux system :

Open terminal and login as root user. copy/move the extracted geckodriver to bin direcctory.
In my case I moved the file to /usr/bin directory. Because the driver finds geckodriver binary in '/usr/bin' path and the problem is solved now.

To move the file inside bin directory use command like -

$mv 'geckodriver binary source path' 'destination path'
destination path should be the binary folder path as per user system.

For Windows System :
Just execute the the extracted geckodriver binary file.