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.
How to know whether or not a element exist on page
Hi All,
I try to use this code to verify whether a element exist on the page:
if (_condition(_link($label) != null)) {
_click(_radio(0, _near(_link($label))));
} else {
_click(_cell(0, _near(_cell($label))));
}
}
Some times it is work fine, but some times even there is a link element, it also clicks the cell element!
I have used the sahi controller to verity _assertExists(_link("xxxx")), it return true, but in the script
_condition(_link($label) != null)
return false and click the cell element.
is it a bug of sahi, please verify!
I try to use this code to verify whether a element exist on the page:
if (_condition(_link($label) != null)) {
_click(_radio(0, _near(_link($label))));
} else {
_click(_cell(0, _near(_cell($label))));
}
}
Some times it is work fine, but some times even there is a link element, it also clicks the cell element!
I have used the sahi controller to verity _assertExists(_link("xxxx")), it return true, but in the script
_condition(_link($label) != null)
return false and click the cell element.
is it a bug of sahi, please verify!
Comments
are you mean the code should like this:
_assertExists(_link($label)); or _wait(10000);
if (_condition(_link($label) != null)) {
_click(_radio(0, _near(_link($label))));
} else {
_click(_cell(0, _near(_cell($label))));
}
}
??
This will wait till given amout of time or provided link was found. whichever occurs first. Assert is much better in your case.
if(_assertExists(_link("clickme"))){
_alert("it exists on the page");
}
if(_condition(_assertExists(_link("clickme")))){
_alert("it exists on the page");
}
if(_condition(_link("clickme"))){
_alert("it exists on the page");
}