I am using excel for data driven testing.
public void login()
{
String uName = username;
String pWord = password;
try
{
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);
selenium.wait(Constants.MAX_WAIT_TIME_MS);
objSelenium.type("xpath=//input[@id='j_password']", pWord);
selenium.wait(Constants.MAX_WAIT_TIME_MS);
}
}catch(Exception e)
{
e.printStackTrace();
}
}
No comments:
Post a Comment