Posts

Showing posts from March, 2014

Data Driven Testing Using Selenium -WebDriver in Python

In this post, I will explain and share the code regarding data driven testing using an external csv file and iterating the tests multiple times with different sets of data as below:

####################################################################

    from selenium import webdriver
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support.ui import Select
    from selenium.common.exceptions import NoSuchElementException
    import unittest, time, re

    class Browse(unittest.TestCase):

   def setUp(self):
       self.driver = webdriver.Firefox()
       self.driver.implicitly_wait(30)
       self.base_url = "http://careergrab.com/"
       filename = 'test.csv'
       line_number = 1
       with open(filename, 'rb') as f:
          mycsv = csv.reader(f)
          mycsv = list(mycsv)
          self.username=mycsv[line_number][0]
          self.password=mycsv[line_number][1]
          self.verificationErrors = []

  def test_browse(s…