1

So as it says in the title I have a problem with importing Selenium module on my Ubuntu laptop. On my Windows pc everything goes fine with basic Selenium code:

from selenium import webdriver
driver = webdriver.Firefox()

but when I try to do that on my Ubuntu machine I get an error that is basically saying:

os.path.basename(self.path), self.start_error_message)
selenium.common.exception.WebDriverException:  Message:'geckodriver'executable needs to be in PATH.

Has anyone encoutered this problem and if yes does anyone know how to fix it?

1

1 Answer 1

1

An easy way to fix this is to download the driver from here: https://github.com/mozilla/geckodriver/releases

Method 1: Adding geckodriver to existing path folder

Unzip the file and copy the "geckodriver" executable to "/usr/bin" using:

cd /folder/containing/geckodriver
sudo cp geckodriver /usr/bin

Method 2: Adding custom geckodriver location to path

You can also add the driver in your system path temporarily with:

export PATH=$PATH:/path/to/geckodriver

For a permanent solution, you can edit your bash profile with:

gedit ~/.profile

Then find the PATH line and modify it to look more like this:

PATH="$HOME/bin:$PATH:/path/to/geckodriver"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.