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.
Using a FOR loop, while fetching a value from a table using sahi, does not give proper result
My Script :
var $table = document.getElementById('ABC')
var $rows = $table.rows ;
for($i=1 ; $i<$rows.length ;$i++)
{
do something ;
}
my $rows.length = 1000 still this condition is coming as unfulfilled and control is not going inside FOR loop. Instead, if I rephrase it like
for($i=1 ; ;$i++)
{
if ($i>=$rows.length)
{ break ; }
else
{
do something ;
}
}
it is working fine. I tried storing the rows.length value in another variable and then using that variable but still it does not work. Could you please help me with this.?
var $table = document.getElementById('ABC')
var $rows = $table.rows ;
for($i=1 ; $i<$rows.length ;$i++)
{
do something ;
}
my $rows.length = 1000 still this condition is coming as unfulfilled and control is not going inside FOR loop. Instead, if I rephrase it like
for($i=1 ; ;$i++)
{
if ($i>=$rows.length)
{ break ; }
else
{
do something ;
}
}
it is working fine. I tried storing the rows.length value in another variable and then using that variable but still it does not work. Could you please help me with this.?
Best Answer
-
Hi sgupta2,
Use the following code:
and use the above variable in your for loop._set($rowsLength,$table.rows.length)
Please let me know whether it works for you.
Regards.
Answers
It worked. Could you please tell me why does not it work other way round.
Thanks
Please have a look at the following link:
Regards.