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

Опубликовано: 13 Февраль 2026
на канале: 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


На этой странице сайта вы можете посмотреть видео онлайн Selenium Java Data Driven Automation - How to Read Data from Excel File длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Lets Learn QA 13 Февраль 2026, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 188 раз и оно понравилось 12 зрителям. Приятного просмотра!