What should I do in order to install Selenium WebDriver in Ubuntu 16.04 (Xenial Xerus)?
-
2Selenium is a testing framework for web applications. You basically automate interactions with the app in the browser and check whether the expected results occur - for example, "if I click on the link that says edit, an textbox with this id should be inserted". Typically, you create many such tests and run them automatically to check whether changes broke something. Selenium WebDriver is a tool from this framework. – Henning Kockerbeck Jul 19 '17 at 18:22
-
Follow the steps given in this link: https://tecadmin.net/setup-selenium-chromedriver-on-ubuntu/ – Faeza Dec 05 '18 at 14:19
4 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:
$ sudo apt-get install python-pip
$ sudo pip install selenium
After the installation, the following code should work:
#!/usr/bin/env python
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://www.ubuntu.com/')
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:
#!/usr/bin/env python
import unittest
from selenium import webdriver
class TestUbuntuHomepage(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def testTitle(self):
self.browser.get('http://www.ubuntu.com/')
self.assertIn('Ubuntu', self.browser.title)
def tearDown(self):
self.browser.quit()
if __name__ == '__main__':
unittest.main(verbosity=2)
Output:
testTitle (__main__.TestUbuntuHomepage) ... ok
----------------------------------------------------------------------
Ran 1 test in 5.931s
OK

- 13,173
Install latest google-chrome webdriver for Python-selenium binding:
$ LATEST=$(wget -q -O - http://chromedriver.storage.googleapis.com/LATEST_RELEASE)
$ wget http://chromedriver.storage.googleapis.com/$LATEST/chromedriver_linux64.zip
$ unzip chromedriver_linux64.zip && sudo ln -s $PWD/chromedriver /usr/local/bin/chromedriver
Try below Example to open 'http://www.ubuntu.com/' in google-chrome browser:
#!/usr/bin/env python
from selenium import webdriver
browser = webdriver.Chrome()
browser.get('http://www.ubuntu.com/')
Following is the link for Firefox-webdriver: Install Firefox web-driver

- 131
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:
export PATH=$PATH:/path/to/directory/of/executable/downloaded/in/previous/step
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.

- 101
Note:
- This File Working In Linux(Debian,Ubuntu,Kali Linux)
- This method is tested In Kali Linux
- This file is not working in Windows
How To Install
Use Code In Terminal Linux(Debian,Ubuntu,Kali Linux)
git clone https://github.com/khaled-dev-loper/webdriver-firefox-installer.git cd webdriver-firefox-installer
Download Your Webdriver From https://github.com/mozilla/geckodriver/releases and extract
geckodriver
inwebdriver-firefox-installer
folderRun Python File:
python3 installation.py
or run Bash File
chmod +x installation.sh ./installation.sh

- 2,945
- 5
- 17
- 26