Selenium Java Data Driven Automation - How to Read Data from Excel File

Publicado em: 13 Fevereiro 2026
no canal de: Lets Learn QA
188
12

Selenium Java Data Driven Automation - How to Read Data from Excel File

Step 1 = Create a Maven Project

Step 2 = Add Apache POI dependencies in POM.xml file
Apache POI
Apache POI ooxml

Step 3 - Create an excel file and save it.

Step 4 - Create object of FileInputStream to read the file.
FileInputStream fs = new FileInputStream("F:\\TestData\\SampleData.xlsx");

Step 5 - //Creating a workbook
XSSFWorkbook workbook = new XSSFWorkbook(fs);

Step 6 - //Identify Worksheet in workbook
XSSFSheet sheet = workbook.getSheetAt(1);

Step 7 - //Get the Row from worksheet
Row row = sheet.getRow(0);

Step 8 - //Get the cell from the Row Reference
Cell cell = row.getCell(0);

Step 9 - //Get the value from the cell.
System.out.println(cell.getStringCellValue());

//System.out.println(sheet.getRow(0).getCell(0));
//System.out.println(sheet.getRow(0).getCell(1));

Step 10 - //How to count total columns getLastCellNum()
System.out.println(sheet.getRow(0).getLastCellNum());

Step 11 - //How to count total Rows
System.out.println(sheet.getLastRowNum());




#javaconcepts #javainterviewquestionsanswers #seleniumjava
#datadriven #automationtesting #automationtestinginterviewquestions
#qatraining #letslearnqa


Nesta página do site você pode assistir ao vídeo on-line Selenium Java Data Driven Automation - How to Read Data from Excel File duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Lets Learn QA 13 Fevereiro 2026, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 188 vezes e gostou 12 espectadores. Boa visualização!