After installing Selenium in Ubuntu and adding geckodriver to path I get this error when I run
from selenium import webdriver
driver = webdriver.Firefox()
In addition to the answer by @Poloq, the simplest way would be keeping your geckodriver
binary in a directory which is already in your PATH
.
mv geckodriver /usr/local/bin
This way you can avoid additional settings/configurations in your project with the downside of having an additional step when deploying on different systems.
In addition to the provided answers, there is also this option where you can copy the driver to /usr/bin
:
sudo cp geckodriver /usr/bin
Selenium is available from the default Ubuntu repositories in Ubuntu 16.04 and later. To install selenium open the terminal and type:
sudo apt install python-selenium # for Python 2.x
and/or
sudo apt install python3-selenium # for Python 3.x
Then type python to start the Python interpreter and from selenium import webdriver should work like this:
$ python
>>> from selenium import webdriver
Assuming that the path ~/.local/bin is in your execution PATH, here's how to install the Firefox webdriver, called geckodriver:
wget https://github.com/mozilla/geckodriver/releases/download/v0.20.1/geckodriver-v0.20.1-linux64.tar.gz
tar xvfz geckodriver-v0.20.1-linux64.tar.gz
mv geckodriver ~/.local/bin
source: https://askubuntu.com/questions/1041541/i-want-to-install-selenium-webdriver-in-my-ubuntu-16-04-system-for-python
Had the same problem. There were two ways to fix this for me:
Add executable_path arg in webdriver:
driver = webdriver.Firefox(executable_path='/path/to/geckodriver')
And the second way its to add folder that contains geckodriver using export (only folder, not geckodriver):
$ export PATH=$PATH:/path/to/
The problem is that you renamed "geckodriver" to "wires".
The solution is to add "geckodriver" to search path then it should work.