Please note that Sahi's development and support teams do not actively monitor this. This is more a community forum. If you are a Sahi Pro user looking for commercial support, please email support @ sahipro.com with your query.

excel.get() method displays NullPointer Exception.

apgarg1512apgarg1512 Members
edited November 2013 in Sahi Pro
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?

Answers

Sign In or Register to comment.