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.
problem with loop
Hi,
Could anyone help me on this.
I am not able to print the for loop alerts in the following code:
_click(_link("Form Test"));
$selectCount = new Array();
$arr = new Array();
_set($selectCount, document.getElementById("s1Id"));
_alert($selectCount.length);
for( $i=0; $i< $selectCount.length; $i++)
{
_alert($selectCount.length);
_alert(_getText($selectCount[$i]));
}
Thanks,
Sarathy CR
Could anyone help me on this.
I am not able to print the for loop alerts in the following code:
_click(_link("Form Test"));
$selectCount = new Array();
$arr = new Array();
_set($selectCount, document.getElementById("s1Id"));
_alert($selectCount.length);
for( $i=0; $i< $selectCount.length; $i++)
{
_alert($selectCount.length);
_alert(_getText($selectCount[$i]));
}
Thanks,
Sarathy CR
Best Answer
-
Please try
_click(_link("Form Test"));
$selectCount = new Array();
$arr = new Array();
_set($selectCount, document.getElementById("s1Id"));
_set($Count, $selectCount.length);
for ($i = 0; $i < $Count; $i++) {
_alert($Count);
_alert(_getText($selectCount[$i]));
}
Answers
From the above code, i have assigned the count to a temp variable and try to convert to Int type and this returns NaN value:
$len = $selectCount.length;
_alert($len); // This prints the count correctly.
$av=parseInt($len);
_alert($av); // This returns NaN value.
Could any help me on this.