Login using Excel data

import java.io.FileInputStream;
import jxl.Sheet;
import jxl.Workbook;
import com.thoughtworks.selenium.DefaultSelenium;
public class Excel extends DriverScript{
public static String login_Excel() throws Exception
{
//DefaultSelenium selenium=new DefaultSelenium("localhost",6666,"*iehta","http://");
FileInputStream file=new FileInputStream("D:\\Framework\\TestData\\login_Data.xls");
Workbook w=Workbook.getWorkbook(file);
Sheet s=w.getSheet(0);
FileInputStream fi=new FileInputStream("D:\\Framework\\ObjectRepository\\login_OR.xls");
Workbook w1=Workbook.getWorkbook(fi);
Sheet s1=w1.getSheet(0);
//Sheet s=w.getSheet("Sheet1");
/*selenium.start();
selenium.open("http://mail.in.com");
selenium.windowMaximize();
*/
// for (int i = 1; i < s.getRows(); i++) {

selenium.type(s1.getCell(0, 1).getContents(), s.getCell(0, 1).getContents());
selenium.type(s1.getCell(1, 1).getContents(), s.getCell(1, 1).getContents());
//System.out.println("the value of i"+i);
//}

// selenium.setTimeout("10000");
selenium.click(s1.getCell(2, 1).getContents());

return "pass";
}
public static String close()
{
selenium.close();
return "pass";
}
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
//login_Excel();

}

}

No comments:

Post a Comment