Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
peter191
Posts : 1
Join date : 2013-06-08

Selenium 2.0 +  Excel Empty Selenium 2.0 + Excel

Sat Jun 08, 2013 5:52 am
Hi,

I am writing the selenium scripts where I am trying to read 16 digit card number from excel sheet.
Excel sheet has 1 column.

For that I have wrote following code.

Code:
public static Vector<Object[]> getCCPayment() throws Exception {
      
      Vector<Object[]>  list = new  Vector<Object[]>();
      File excel = new File("C:/Automation/Koodo_DataDriven/Data/login.xls");
      FileInputStream fis = new FileInputStream(excel);
      HSSFWorkbook wb = new HSSFWorkbook(fis);
      HSSFSheet ws = wb.getSheet("payment");   
      
      for(int c = 0; c<ws.getLastRowNum()+1; c++) {
         HSSFRow row = ws.getRow(c);
         int columnNumber = 1;
         String[] xuser = new String[columnNumber];
         for (int j = 0; j<2; j++ ) {
            HSSFCell paymentcell = row.getCell(j);
            String xvalue = cellToStringPayment(paymentcell);
            xuser[j] = xvalue;
            System.out.println("the value is" + xvalue);            
         }
         list.add(xuser);
      }
   return list;   
}


Upon execution of above code, I am getting following result with error:

the value is1.23456789123456E14
Exception in thread "main" java.lang.NullPointerException
at com.koodomobile.util.ExcelRead.cellToStringPayment(ExcelRead.java:98)
at com.koodomobile.util.ExcelRead.getCCPayment(ExcelRead.java:58)
at com.koodomobile.util.ExcelRead.main(ExcelRead.java:16)


The value in excel file is 123456789123456.
But the value I'm receiving as result is different in decimal with error message? confused

Can somebody help me what's the issue here and how can I solve it?
Back to top
Permissions in this forum:
You cannot reply to topics in this forum