Selenium is an automation tool which is composed of multiple software tools like selenium IDE,webdriver,Selenium RC,Selenium grid.

Key features of Selenium includes:

1.Multiple browser support:Firefox,Chrome,Safari,Opera,Yes
2.Multiple OS support:Windows,OS X,Linux,Android and IOS
3.Multiple language support:Python,Ruby,Java
4.Free as in beer and freedom

Selenium supports different languages, here I would like to show you how to implement Selenium Webdriver with Python (Python 2.7).

It is a package management tool used to install and manage software package, written in Python.

It provides an isolated working environment which allow us to work on a specific project without worrying about affecting other projects.

In Order to install it simply do,

1pip install virtualenv

Other python packages

There are other python packages.These are also need to be installed


In order to install this packages use the code

1.pip install selenium==2.40
2.pip install nose

We can use any OS,programming language and browser. Here I would like to show you how to implement Selenium Webdriver with Python.

  • OS:Windows 8
  • Python: python 2.7
  • Browser: Firefox 28
  • Selenium: Selenium 2.40

Writing a test

Automation testing performs the same functionalities as manual testing. But this is done with computer which allow you to do other works as well as easily repeat your tests. Test code runs a series of instruction to interact with web browser.

Write a sample test

For the cause, I am using a website using firefox. Make sure that title is “Home mahara” and also we can easily login using the respective credentials. Type the following code in the python shell and run it .

1.import unittest

2.from selenium import webdriver

3.from selenium.webdriver.common.keys import Keys

4.class DemoMaharaOrgLogin(unittest.TestCase):

5.def setUp(self):

#define a driver instance.for example firefox

6. self.driver=webdriver.Firefox()

7. def test_login_in_demo_mahara_org(self):

8. driver=self.driver

#navigate to the demo website

9. driver.get(“”)

#do assertion on the site title

10. self.assertIn(“Home-Mahara”, driver.title)

#define username web element


#enter username as student1



#enter password as testing1


#define login button


#click on the login button


#verify that logout button displays

17. self.assertTrue(driver.find_element_by_link_text(“Logout”),”Logout link”)

18.def tearDown(self):

19. self.driver.close()

I hope this blog gives you a good insight about implementing Selenium Webdriver with Python. Feel free to contact for any queries.