Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
163 views
by
edited by
How to read correct data while reading numeric data from excel sheet?

I am reading some numeric and string test data from the excel sheet but when printing the numeric data into the console it is displaying in the wrong manner.
TestDate in excel sheet,
mobile number = 7507680723  
birthday = 17-06-1993

In console output using print stament:-
for mobile number 7.507680723E9     
for birthday: 34137.0

In Application filed:-
for mobile number field it is entering the right mobile number = 7507680723.

for birth date field it is entering the wrong birth date= 31/04/2070

I have used numericCellValue() method to get numeric value.

I want proper data should be print in the console and enter into the application field.
Please help ASAP

1 Answer

0 like 0 dislike
by Contributing Tester (99 points)

In such cases, I used to modify my cell type to text, even though the data type is number.

To change the cell type in excel,

  1. Select the cell(s) you want to modify.
  2. Click the drop-down arrow next to the Number Format command on the Home tab. The Number Formatting drop-down menu will appear.
  3. Select the desired formatting option. In our example, we will change the formatting to Text

Now you try to retrieve data. It should come as a plain text.

 

 

 

by Contributing Tester (51 points)
Thanks for helping.
It is working fine now.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...