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.
If condition not working.
Hello can anyone help me to resolve this problem, if condition not working.
var $title = document.title;
var $links = document.links;
var $length = $links.length;
for (var i=0; i<$length; i++)
{
if(_condition(_containsText($links.innerText == $groupName)))
{
_alert("already available");
$found = false;
_getGlobal("found", false);
}
else
{
$found =true;
_setGlobal("found", true);
}
}
}
Here if(_condition(_containsText($links.innerText == $groupName))) is not working fine for me.
var $title = document.title;
var $links = document.links;
var $length = $links.length;
for (var i=0; i<$length; i++)
{
if(_condition(_containsText($links.innerText == $groupName)))
{
_alert("already available");
$found = false;
_getGlobal("found", false);
}
else
{
$found =true;
_setGlobal("found", true);
}
}
}
Here if(_condition(_containsText($links.innerText == $groupName))) is not working fine for me.
Comments
First of all assining the length irectly toa variable won't work. either use _set() to set the value or directly use $links.length in the for loop condition. Second what is $groupname? Elaborate on what exactly what you want the code do.
Regards,
Pankaj.