Selenium 2.2.0 & Python installation guide on Linux

Share on Facebook0Share on LinkedIn0Share on Google+1Tweet about this on Twitter1Email this to someoneDigg this

Here is the guide to install and using Selenium Webdriver and Python on Ubuntu Linux 11.04.
OS: Ubuntu 11.04
1. Verify version of Java is greater than version 1.5, use command:-
$ java –version
If java needs to be installed, use the following command:-
$ sudo apt-get install sun-java6-jre

2. Version of Python is 2.7x, use following command to display version on machine:-
$ python –version
If python needs to be installed, use the following command:-
$ sudo apt-get install python

3. We need to install ‘pip’ – a tool for managing Python packages, use the following command to install pip:-
$ sudo apt-get install python-pip

4. We now need to install the Selenium bindings for Python to use the Selenium API, use the following command to install Selenium:-
$ sudo pip install selenium

5. We can now create the following test example, using a text editor, save as
#!/usr/bin/env python

import unittest
from selenium import webdriver
class TestSeleniumWikiTitle(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def testTitle(self):
self.assertIn('Selenium Tips, Webdriver Tips, C# Selenium Examples, Java Selenium Example, Selenium2 Webdriver, Selenium Web Testing Guide', self.browser.title)
def tearDown(self):
if __name__ == '__main__':

6. To execute the test, use the following command:-
$ python

Submitted by Barry Horgan

2 thoughts on “Selenium 2.2.0 & Python installation guide on Linux

  1. Sanyam says:

    I am on a network behind a proxy. When i run a script like this, i get a new instance of Firefox with no proxy configured, that obviously fails to connect to any external site. I tried setting http_proxy env variable from shell but that didn’t work. On the WebDriver FAQ on, i found this Java code for webdriver script that addresses this issue:

    Proxy proxy = new Proxy();

    // We use firefox as an example here.
    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    capabilities.setCapability(CapabilityType.PROXY, proxy);

    // You could use any webdriver implementation here
    WebDriver driver = new FirefoxDriver(capabilities);
    How do i translate this to Python? Please help

  2. Sasi says:

    Hi bro.. It worked for me exactly. Thank you.

    Do you have the documentation for how to set up python-selenium project in eclipse?? I got a struck when adding external file to the project.

    Thank you again.

Leave a Reply

Your email address will not be published. Required fields are marked *