I am using keyword driven framework to create the script in selenium.Any one please provide me script how to write the data into excel sheet with proper column names. Suppose once the customer is created then it will create one customer id so i want to save this customer id in output.xls file with mobile number for each customer registration one by one,if i run for 100 test data records it should save 100 customers customer id with mobile number.Any one please help me in this once.

  • Hi Rajesh. There are actually many questions and answers on this site explaining it. Please keep in mind though, that Selenium can't do this, it's only a framework meant for accessing a browser. You will need to do this through your Java code. Jul 21, 2016 at 12:54
  • Rajesh, If you got satisfied answer, Accept it. So this question will no longer be active state. Jul 21, 2016 at 16:31

2 Answers 2


@Lyndon, Completely agree. @Rajesh, Its not the area of Selenium. Its open source framework for web-automation and now they have extension of it for mobile platform called as Appium.

Not possible using Selenium!


Selenium doesn't provide any functionality to deal with Excel documents, however assuming you're using Java you can read and write Excel files using Apache POI library

Reference code:

Workbook wb = new HSSFWorkbook();   
CreationHelper createHelper = wb.getCreationHelper();
Sheet sheet = wb.createSheet("Sheet1");

Row row = sheet.createRow(0);
Cell cell = row.createCell(0);
cell.setCellValue(createHelper.createRichTextString("Hello world")); 

FileOutputStream fileOut = new FileOutputStream("workbook.xls");

Useful material:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.