- peter191
- Posts : 1
Join date : 2013-06-08
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.
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?
Can somebody help me what's the issue here and how can I solve it?
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?
Can somebody help me what's the issue here and how can I solve it?
Permissions in this forum:
You cannot reply to topics in this forum
|
|