I'm running a simple example of selenium on Linux:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("something")
and get an error:
FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver'
How to fix it?
$ python
Python 3.5.2 (default, Jun 28 2016, 08:46:01)
[GCC 6.1.1 20160602] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import selenium
>>> from selenium.webdriver.common.keys import Keys
>>>
I faced same issue in Linux. I used below steps to fix that Error.
Note : I tried with latest version geckodriver-v0.26.0 but it not working for me, That's Why I installed the old version v0.24.0
Downloading geckodriver
The geckodriver executable can be downloaded here.
Python3 venv
Download the geckodriver executable from the above link and extract it to
env/bin/
to make it accessible to only the virtual environment.In your python code, you will now be able to do the following:
Linux
If you would like to make it available system wide, download the geckodriver executable from the above link and extract it to
/usr/bin/
(or anything inside of your $PATH)Windows
Note: this needs a windows user to test and confirm
Download geckodriver from the above link and extract it to
C:\Windows\System32\
(or anything inside your Path environment variable).Mac OS X
Note: I took this from Vincent van Leeuwen's answer in this very question. Putting it here for the sake of lumping everything in one answer
To make geckodriver available system wide, open up your Terminal App and perform the following command:
brew install geckodriver
More Info
More info on selenium can be found here:
On linux, you can install Homebrew and then
brew install geckodriver
through itor by installing Nix
but adding another package manager to your system might be a bad idea.
Selenium requires geckodriver to interface with Firefox. Here's how to install geckodriver:
sudo mv ~/Downloads/geckodriver /usr/bin
If you're on Mac OSX, you can just do
brew install geckodriver
.Source: https://formulae.brew.sh/formula/geckodriver