import java.io.IOException; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Login { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { // TODO Auto-generated method stub for(int i=1; i<=4; i++){ WebDriver myDriver=new FirefoxDriver(); myDriver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS); myDriver.get("https://www.revenewonline.net/rolcelive_test/index.aspx"); myDriver.findElement(By.name("user_name")).sendKeys(FuncLib.fn_GetCellData("Login", "UserName", i)); myDriver.findElement(By.xpath("//input[@name='user_password']")).sendKeys(FuncLib.fn_GetCellData("Login", "UserName", i)); myDriver.findElement(By.xpath("//input[@name='Login']")).click(); myDriver.close(); } } } ############################################################################################## import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.math.BigDecimal; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class FuncLib { public static String TestDataPath=".xlsx"; public static String fn_GetCellData(String SheetName, String ColumnName, int Rownumber) throws IOException{ File xlFile=new File(TestDataPath); FileInputStream fis=new FileInputStream(xlFile); XSSFWorkbook workbook_Object=new XSSFWorkbook(fis); int columnNum=0; Sheet sheetobj=workbook_Object.getSheet(SheetName); for(int i=0; i<=sheetobj.getRow(0).getLastCellNum(); i++){ String ColName=sheetobj.getRow(0).getCell(i).getStringCellValue(); if(ColumnName.equalsIgnoreCase(ColName)){ columnNum=i; break; } } Row Required_ROw_Object=sheetobj.getRow(Rownumber); Cell Required_CellObject= Required_ROw_Object.getCell(columnNum, Required_ROw_Object.CREATE_NULL_AS_BLANK); String TestData=""; int cellType=Required_CellObject.getCellType(); if(cellType==XSSFCell.CELL_TYPE_NUMERIC){ BigDecimal myVal=BigDecimal.valueOf(Required_CellObject.getNumericCellValue()); TestData=myVal.toPlainString(); }else if(cellType==XSSFCell.CELL_TYPE_BLANK){ TestData="" ; }else if(cellType==XSSFCell.CELL_TYPE_STRING){ TestData=Required_CellObject.getStringCellValue(); } fis.close(); return TestData; } }