This blog is for Automation Test Engineers

Sunday, 3 September 2017

How to take data from external source like excel

WebDriver driver=new FirefoxDriver();
driver.get("https://www.facebook.com/");
WebElement username=driver.findElement(By.id("email"));
FileInputStream fis=new FileInputSteam("D:\\testsdata.xlsx");
WorkBook wb=WorkBoolFactory.create(fis);
Sheet s=wb.getSheet("sample");
Row r=s.getRow(2);
Cell c=r.getCell(0);
String v=c.getStringCellValue();
usernametxtbox.senkeys(v);
WebElement pwdtxtbox=driver.findElement(By.id("pass"));
Row r=s.getRow(3);
Cell c=r.getCell(1);
String v1=c.getStringCellValue();
pwdtxtbox.senkeys(v1);

}


0

0 comments:

Post a Comment