RE: java.lang.NullPointerException

When i trying to read the data from excel sheet and if that column is blank then webdriver throwing the error “java.lang.NullPointerException”.
So how to handle this error whenever column has no data?

onimje Default Asked on December 31, 2014 in Selenium WebDriver.
Add Comment
2 Answers

OK…I solved it using try catch block…
try {
Cell = ExcelWSheet.getRow(RowNum).getCell(ColNum);
String CellData = Cell.getStringCellValue();
return CellData;
} catch (Exception e) {
return “”;
}

Thanks for your reply!!!

Default Answered on December 31, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.