I have successfully read data from an Excel file , consisting of three columns(URL/FQDN , username , password). This Excel Sheet consists of FQDNs of various servers of mine. I have another function that needs to perform certain task on all of these servers. Since I am very new to Selenium/java , I would appreciate any help regarding the fact on how I can open all the url's on different browser windows , and pass username and password for each one of them. And later on I can try to manage the task/same action which I need to perform on all of them Here's the piece of code I have written so far to read Excel Sheet-:
public class modif {
public static FileInputStream fis;
public static XSSFWorkbook wb;
public static XSSFSheet sheet;
public static String row;
public static XSSFCell cell;
public static void main(String[] args) {
try {
getCellData();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void getCellData() throws IOException
{
fis=new FileInputStream("C:\\Users\\windows\\Desktop\\hostname.xlsx");
wb=new XSSFWorkbook(fis);
sheet=wb.getSheet("hostname");
int rowCount = sheet.getLastRowNum()-sheet.getFirstRowNum();
//Create a loop over all the rows of excel file to read it
for (int i = 0; i < rowCount+1; i++) {
Row row = sheet.getRow(i);
//Create a loop to print cell values in a row
for (int j = 0; j < row.getLastCellNum(); j++) {
//Print Excel data in console
System.out.print(row.getCell(j).getStringCellValue() + " ");
}
System.out.println();
}
}
}