Favourite Quote

Every artist was first an amateur. - Ralph Waldo Emerson The more difficulties one has to encounter, within and without, the more significant and the higher in inspiration his life will be. - Horace Bushnell

Wednesday, November 10, 2010

DataDriven Testing using Selenium - java

I am using excel for data driven testing.

public void login()
String uName = username;
String pWord = password;
FileInputStream fi = new FileInputStream ("C:\\Selenium\\datainput\\webservices.xls");
Workbook wbk = Workbook.getWorkbook(fi);
Sheet sht = wbk.getSheet("Credentials");
for(int rowCount=1;rowCount<=sht.getRows();rowCount++)
uName = sht.getCell(1,rowCount).getContents();
pWord = sht.getCell(2, rowCount).getContents();
objSelenium.type("xpath=//input[@id='j_username']", uName);
objSelenium.type("xpath=//input[@id='j_password']", pWord);
}catch(Exception e)
} automationwithselenium.blogspot.com-Google pagerank and Worth

No comments:

Post a Comment