Apache POI with Selenium Webdriver

In every Development environment data is mandatory part of their development, we put all your data in in your program files. But if any change in data results editing of the program file, which makes us to recompile the code and retest the compiled code.

If data Changes every day, are we going to edit the program file every day?
What happens if compilation fails ?

Development should happen in such a that data donot have any effect on the program files. Placing data outside program is the only way to do it, like placing the data on excel files, property files, config file, Json Files, Xml files.

Apache POI

Apache POI helps Java/Java related technologies to read and write Excel files on different platforms, Using apache poi we can do read and write operation of both xls and xlsx file formats. Apache poi is open source tool developed by apache.

Apache POI will be helpful to modify large content of data. Below are the step by step process to download Apache poi jar files.

Follow below steps to download Apache Poi:

1. Open https://poi.apache.org/
2. Click Downloads section on right side

3. Click on poi-bin-#####.zip link under binary distribution section

4. Click on the mirror link, apache would be suggesting nearest location for your mirror link

5. Your poi files will be started to download

6. Extract the downloaded zip file

7. Extracted folder should contain below files. inside-apache-poi-folder-selenium-webdriver

Headless browser in Selenium webdriver

Apache POI and Selenium Webdriver Integration

We can integrate apache poi with selenium webdriver to read and write excel files, and to make a data driver framework.

Follow below steps to integrate Apache Poi with selenium webdriver:

1. Open eclipse selenium webdriver project
2. Right click on the project and select Properties option project-properties-apache-poi-selenium-webdriver

3. Click on Add External jars button

4. Navigate to folder where you have extracted apache poi zip file and add all the jars under main folder, jars under lib, jars under ooxml-lib

5. Click 'OK' on Build path Dialog afetr adding jar files

6. Create a Java Class under a package(files package here)

7. To test we have added apache poi succcessfully, type Workbook inside main method and press CTRL+Space Bar, if you can options from apache poi then integration is successful: presence-of-apache-poi-jars-selenium-webdriver

About Author

Myself KarthiQ, I am the author of this blog, I know ways to write a good article but some how I donot have the skills to make it to reach people, would you like help me to reach more people By sharing this Article in the social media.

Share this Article Facebook
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions
Copyright © CherCher Tech