How would you read data from an excel file for parameterization in Playwright file ?

import com.microsoft.playwright.*;
public class ExcelParameterizationExample {
   public static void main(String[] args){
       try {
           FileInputStream file = new FileInputStream(new File("data.xlsx"));
           XSSFWorkbook workbook = new XSSFWorkbook(file);
           XSSFSheet sheet = workbook.getSheetAt(0);
           Iterator<Row> rowIterator = sheet.iterator();
           while (rowIterator.hasNext()) {
               Row row = rowIterator.next();
               Cell cell = row.getCell(0);
               System.out.println(cell.getStringCellValue());
           }
           workbook.close();
           file.close();
       } catch (Exception e) {
           e.printStackTrace();
       }
   }
}

Using Apache POI library
Using Java IO library
Using Playwright ExcelReader class
Using Java FileReader class
Verified Answer
Correct Option - a

To get all Infosys Certified Playwright Java Automation Tester Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee

Telegram