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.
Return value for assertions
Hi Narayan.
I have another question about assertions.
Is there anyway, in the assertion, when it is a success or it fails, to make Sahi give me a response about this?
I don't know if you can understand, but its something like this:
Thanks.
I have another question about assertions.
Is there anyway, in the assertion, when it is a success or it fails, to make Sahi give me a response about this?
I don't know if you can understand, but its something like this:
var $test;
if(assertion is a success){
$test = "success";
doSomething();
}else{
$test = "fail";
doSomethingElse();
}
Thanks.
This discussion has been closed.
Comments
What you are looking for is not an assertion, but just the outcome of a condition.
Eg:
if($a == 10)
or
if (_condition(_containsText(_div("error_msg"), "Invalid login")))
Don't use an assertion in these places.
An assertion checks for a condition, and throws an exception if the condition is false. This causes the script to log an error message. You should not use assert statements for conditional flow.
Regards,
Narayan
But both 'if' log "error".
Without '_condition', they log "success".
Also tried:
if(_condition(_textbox("\$V_Id").value == ""))
But always throws an exception.
is the correct way to do it. (_containsText is for innerText matches)
Could you share the exception?
_sahi.saveCondition("__lastConditionValue__0", _textbox("\$V_Id").value == "")
TypeError: '_sahi._textbox(...).value' is null or not an object
No trace available
Click for browser script at 31/03/2010 13:43:06
The system runs in an popup window, I don't know if I need to use "_popup("mysystem")", I tried, but no results.
_condition does not work on popups.
You will need to do
Thanks