This question already has an answer here:

I installed python3-selenium apt package on Ubuntu 16.04. While installing, got a message:

Suggested packages:
chromedriver firefoxdriver
The following NEW packages will be installed:

When I try to run the following python code,

#! /usr/bin/python3.5
from selenium import webdriver
import time

def get_profile():
    profile = webdriver.FirefoxProfile()
    profile.set_preference("browser.privatebrowsing.autostart", True)
    return profile

def main():
    browser = webdriver.Firefox(firefox_profile=getProfile())

    #browser shall call the URL

if __name__ == "__main__":

I get the following error:

Traceback (most recent call last):
    File "./test.py", line 19, in <module>
    File "./test.py", line 11, in main
        browser = webdriver.Firefox(firefox_profile=getProfile())
    File "/usr/lib/python3/dist-packages/selenium/webdriver/firefox      /webdriver.py", line 77, in __init__
self.binary, timeout),
    File "/usr/lib/python3/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
    File "/usr/lib/python3/dist-packages/selenium/webdriver/firefox/firefox_profile.py", line 91, in add_extension
    File "/usr/lib/python3/dist-packages/selenium/webdriver/firefox/firefox_profile.py", line 251, in _install_extension
compressed_file = zipfile.ZipFile(addon, 'r')
   File "/usr/lib/python3.5/zipfile.py", line 1009, in __init__
self.fp = io.open(file, filemode)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib /firefoxdriver/webdriver.xpi'

I did searching for packages name firefoxdriver in Ubuntu repositories but none exist.

Any help with installing the webdrivers appreciated.

marked as duplicate by karel, user535733, N0rbert, David Foerster, dadexix86 May 30 '18 at 20:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


You need to download the latest geckodriver, then untar the file and put it in your path (i.e. ~/.local/bin).

This will solve the exception but your program will be hanging after this line :

browser = webdriver.Firefox(firefox_profile=getProfile())

The only solution I found is to downgrade Firefox.

First, list the available versions :

apt-cache policy firefox

Then install a version lower than 49 (45.0.2+build1-0ubuntu1 for me) :

sudo apt install firefox=45.0.2+build1-0ubuntu1

You could use chromium instead ...

Not the answer you're looking for? Browse other questions tagged or ask your own question.