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.
While condition
Hi,
Is there something wrong in this snippet ?
The code is supposed to scan line by line an array until it finds a precise device ($mast_name[$i]), and this for a given number of device ($nbmasters). If it doesn't find the device, it has to go to the next line, by incrementing $j, but it doesn't ...and returns :
Is there something wrong in this snippet ?
function verify_masters_work(){
//_wait(23*$delay)
_click(_link("GSM Device"));
_wait(2*$delay);
var $i=0;
var $j=0;
for($i=0;$i<$nbmasters;$i++){
while(_condition(_getText(_cell(_table(33),$j,1))!=$mast_name[$i])){
$j++;
}
_assertContainsText("device ready",_cell(_table(33),$j,4));
$j=0;
}
}
It doesn't want to increment $j variable.The code is supposed to scan line by line an array until it finds a precise device ($mast_name[$i]), and this for a given number of device ($nbmasters). If it doesn't find the device, it has to go to the next line, by incrementing $j, but it doesn't ...and returns :
_click(_link("GSM Device"));
_wait(2*8000);
saveCondition(_getText(_cell(_table(33),0,1))!="Master100");
saveCondition(_getText(_cell(_table(33),0,1))!="Master100");
saveCondition(_getText(_cell(_table(33),0,1))!="Master100");
saveCondition(_getText(_cell(_table(33),0,1))!="Master100");
saveCondition(_getText(_cell(_table(33),0,1))!="Master100");
saveCondition(_getText(_cell(_table(33),0,1))!="Master100");
--Stopped Playback: FAILURE--
Any idea ?
Comments
It's exactly the same than in a previous post : http://www.sahi.co.in/forums/viewtopic.php?id=174
Sahi compiler bugs and add a "//" just before "$j++", so that makes incrementation invisible when running script ! I get arround by adding // like this :
while(_condition(_getText(_cell(_table(33),$j,1))!=$mast_name[$i])){
//
$j++;
}