18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
excel.get() method displays NullPointer Exception.
I am writing a script to fetch different Email Ids from an excel sheet to register into a particular website. The Email Ids are listed in a single column in the excel sheet. They are being fetched using a for loop and .get() method. As the number of email ids in the excel could vary, I want to give a termination condition accordingly. Because of this, I used $excel.get($i,0)!=null as the termination condition. This condition is not being recognized by Sahi and when the index reaches the empty cell, it displays a NullPointerException.
My code snippet follows:
for(var $i=0; $excel.get($i,0)!= ""; $i++)
The exception follows:
Wrapped java.lang.NullPointerException
I have searched for other ways but didn’t get success. I have used Try() and Catch() as a last resort. Is there any other way also?
My code snippet follows:
for(var $i=0; $excel.get($i,0)!= ""; $i++)
The exception follows:
Wrapped java.lang.NullPointerException
I have searched for other ways but didn’t get success. I have used Try() and Catch() as a last resort. Is there any other way also?
Answers
what about calculate the length and loop until it?
var $excelHandle = _getExcel($excelFilePath, $sheetName);
var $arry= $excelHandle.getData();
for $i<$arry.length.
Regards,
Bhavitha