Start building your web presence at Rs. 499.00/mo

Start building your web presence at Rs. 499.00/mo
Web Hosting Coupon Archives

Read numeric data from Excel using apache poi for Selenium Webdriver - Automation


How to read numeric data from Excel using apache poi for Selenium Webdriver

In the last post, we have already discussed how to read excel data using POI but we have missed one important point which can become the blocker for you. We can read numeric data from Excel using apache poi  for Selenium webdriver.
Our test data contains numeric data, string data, and sometimes combination as well which is totally dynamic in nature. so we need to create such library which will take care of dynamic data.

Read numeric data from Excel using apache poi

read numeric data from Excel using apache poi
read numeric data from Excel using apache poi

Program to read numeric data from Excel using apache poi


Few observations while reading the different set of Data
  1. You need to make sure which kind of data you want to read.
  2. To read String value you can call getStringCellValue() method
  3.  To read Numeric value you can call getNumericCellValue() which will return double value which we can typecast into int and then we can use in our test data.
You can check below screenshot which will explain what are the different type of methods which can help us to read data.
read numeric data from Excel using apache poi
read numeric data from Excel using apache poi

While implementing Data-driven framework you have to make sure that data which is coming from excel should be used in script effectively.
The Same concept will be applied while writing to excel as well. While passing the data to excel you can call respective methods.
Let’s see the below screenshot for more details.
read numeric data from Excel using apache poi

In above screenshot,you can see it will ask you to pass the specific data to write in excel.
Hope above post will help you to read the numeric data from excel.
If you have any doubt then let me know in comment section.
SHARE

yash

  • Image
  • Image
  • Image
  • Image
  • Image

0 comments:

Post a Comment