Download Selenium Webdriver For Ubuntu

Active9 months ago

This tutorial will help you to setup Selenium with ChromeDriver on Ubuntu. The WebDriver is an open. You need to download the Selenium standalone.

What should I do in order to install Selenium Webdriver in Ubuntu 16.04?

karel
67.9k14 gold badges152 silver badges172 bronze badges
A. AlamA. Alam

3 Answers

The below info were taken from: Python - Getting Started With Selenium WebDriver on Ubuntu/Debian

WebDriver (part of Selenium 2) is a library for automating browsers, and can be used from a variety of language bindings. It allows you to programmatically drive a browser and interact with web elements. It is most often used for test automation, but can be adapted to a variety of web scraping or automation tasks.

To use the WebDriver API in Python, you must first install the Selenium Python bindings. This will give you access to your browser from Python code. The easiest way to install the bindings is via pip.

On Ubuntu/Debian systems, this will install pip (and dependencies) and then install the Selenium Python bindings from PyPI:

After the installation, the following code should work:

This should open a Firefox browser sessions and navigate to http://www.ubuntu.com/

Here is a simple functional test in Python, using Selenium WebDriver and the unittest framework:

Output:

YaronDownload Selenium Webdriver For UbuntuYaron
9,6527 gold badges22 silver badges43 bronze badges

Install latest google-chrome webdriver for Python-selenium binding:

Try below Example to open 'http://www.ubuntu.com/' in google-chrome browser:

Following is the link for Firefox-webdriver: Install Firefox web-driver

dreamWalkerdreamWalker

You may also need to update the path, as explained here

  • On Unix systems you can do the following to append it to your system’s search path, if you’re using a bash-compatible shell:

  • On Windows you will need to update the Path system variable to add the full directory path to the executable geckodriver manually or command line(don't forget to restart your system after adding executable geckodriver into system PATH to take effect). The principle is the same as on Unix.

Ioannis NasiosIoannis Nasios

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

Active2 years, 11 months ago

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

For

When I try to run the following python code,

I get the following error:

Traceback (most recent call last): File './test.py', line 19, in main() 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 self.profile.add_extension() File '/usr/lib/python3/dist-packages/selenium/webdriver/firefox/firefox_profile.py', line 91, in add_extension self._install_extension(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.How do I solve this problem?

Any help with installing the webdrivers appreciated!

Saurabh Gaur
18k7 gold badges32 silver badges58 bronze badges
chanzerrechanzerre
1,1894 gold badges13 silver badges23 bronze badges

2 Answers

You can either upgrade to 16.10 (it's in yakkety) or you can download the deb from here (it works - I tried it). Alternatively you can follow these instructions to install by hand (chromedriver but for Firefox it's the same).

Maksim LeventalMaksim Levental

I'm not certain if this will fix the issue you're having, but you can give it a try. But first, to answer the question as to where you can download firefoxdriver, my answer would be maybe firefoxdriver is not available, because the file is now called geckodriver, but it's really called Marionette Driver. It's described here: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver , and it's made available here https://github.com/mozilla/geckodriver/releases

That answers the question, I believe, however I'd like to try to address the issue you're having.

Download Selenium Webdriver For Ubuntu

My understanding of your issue:You're trying to spawn an instance of firefox, through selenium, but it's not working.

My hypothesis as to why it's not working:Maybe you're using Firefox 47 or newer. If you're looking for where to downlad the new 'firefoxdriver' (its called the Marionette Driver, but the file is called geckodriver), you'll have to download the file directly from its github release page: https://github.com/mozilla/geckodriver/releases (I suggest downloading v0.9.0, since v0.10.0 hasn't worked for me).

If you're using Firefox 47 or newer, then starting up Firefox browser with a simple browser = webdriver.Firefox() just isn't going to work. This used to work for Firefox 46, and I'm assuming older versions, however it no longer works because support for Firefox Webdriver has now been dropped. You now have to download the new Marionette driver, and modify your code a bit to make it work with this new driver. You can learn more about Marionette in the link I provided above.

The solutions I'm proposingYou can either:

  1. Download and downgrade to Firefox 46

Download Selenium Webdriver For Java

or

  1. Download the new Marionette driver and adapt your code to work with it

If you choose option #1, then simply find a way to downgrade to Firefox 46.

If however you want your code to work with the most recent release of Firefox, then you choose option #2 and the basic gist of how to accomplish that is as follows:

  1. Download and extract the driver
  2. Make sure that your OS can find the file in its systempath
  3. Modify your code to work with the new Marionette webdriver

The specific step by step process (for ubuntu) can be found in this stackoverflow answer launch selenium from python on ubuntu

selenium should be able to spawn firefox normally once that's done.

B BB B

Download Selenium Webdriver For Ubuntu

Not the answer you're looking for? Browse other questions tagged pythonpython-3.xseleniumselenium-webdriverpython-3.5 or ask your own question.