0

i have code for keyword driven framework with below piece of code with DriverScript class:

for (int iRow=1;iRow<=8;iRow++){
        actionKeywords = new ActionKeywords();
        method = actionKeywords.getClass().getMethods();
         sActionKeyword = ExcelUtils.getCellData(iRow, Constants.Col_ActionKeyword);
         sPageObject = ExcelUtils.getCellData(iRow, Constants.Col_PageObject);
         execute_Actions();

    }

And ExcelUtils class:

     public static String getCellData(int RowNum, int ColNum) throws Exception{
  Cell = ExcelWSheet.getRow(RowNum).getCell(ColNum);
   String CellData = Cell.getStringCellValue();
   return CellData;
}

Error displayed when executing this:

    Exception in thread "main" java.lang.NullPointerException
at utility.ExcelUtils.getCellData(ExcelUtils.java:33)
at ExecutionEngine.DriverScript.main(DriverScript.java:65)
Ashwini
  • 1
  • 2
  • 3
    Possible duplicate of [What is a NullPointerException, and how do I fix it?](https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it) – OH GOD SPIDERS Nov 20 '17 at 11:28
  • Whilst debugging, see if the value for `ExcelWSheet.getRow(RowNum)` is null. Also see if `Cell` is null. – Eduard Nov 20 '17 at 12:08
  • Thanks Eduard. The cell values for some column was blank (Null) which was causing error. so now i put some random data like (test) in it and now code works fine for me – Ashwini Nov 20 '17 at 14:16

1 Answers1

0

Thanks Eduard. The cell values for some column was blank (Null) which was causing error. so now i put some random data like (test) in it and now code works fine for me

Ashwini
  • 1
  • 2