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.
TryCatch
Does the try catch block work in Sahi like it does in JavaScript?
This is what I am trying to do I want to wrap the Assert functions so that I can use them in conditional statements.
i.e function wrapper
function assertAreEqual($expectedValue, $actualValue, $logMessage)
{
try
{
_assertEqual($expected, $actualValue, $logMessage);
return true;
}
catch(err)
{
_log($logMessage);
return false;
}
}
the call using the wrapper:
var $something = "A"
if(assertAreEqual($something, $something, "PoopyPants") == "true")
{
_log("It was true");
}
else
{
_log("It was false");
}
problem is the assertAreEqual is always throwing false! ANYONE????
This is what I am trying to do I want to wrap the Assert functions so that I can use them in conditional statements.
i.e function wrapper
function assertAreEqual($expectedValue, $actualValue, $logMessage)
{
try
{
_assertEqual($expected, $actualValue, $logMessage);
return true;
}
catch(err)
{
_log($logMessage);
return false;
}
}
the call using the wrapper:
var $something = "A"
if(assertAreEqual($something, $something, "PoopyPants") == "true")
{
_log("It was true");
}
else
{
_log("It was false");
}
problem is the assertAreEqual is always throwing false! ANYONE????
Comments
http://sahi.co.in/w/if-condition
What does "return true" allows you to do in this script ?
Thank you for this idea.