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.
Why any other statement within Switch Case statement not working for SahiPro 5.0.3
Why any statement within Switch Case Statement not working for SahiPro 5.0.3
Hi,
It looks like there is some issue with Switch Case statement execution on SahiPro 5.0.3 version
No other statements apart from _log, _logException working within switch case.
This is completely breaking my existing framework as I have widely used switch statements
Here is example code
var $env = "A";
_alert("Alert Working outside Switch");
switch ($env){
case "A":
{
_alert("A alert");
_logException("A LogException");
break;
}
default:
{
_alert("default Alert");
_log("default Log");
break;
}
}
Result
Starting script
_alert("Alert Working outside Switch") [110 ms] [06:29:09.317]
Logging exception: [38 ms] [06:29:09.355]
A LogException
Total Memory in JVM (Xmx) is: 247.5 MB;
Memory currently in use is: 17.77734375 MB;
Memory increment during this test is: 0 MB [1 ms] [06:29:09.356]
Stopping script
Hi,
It looks like there is some issue with Switch Case statement execution on SahiPro 5.0.3 version
No other statements apart from _log, _logException working within switch case.
This is completely breaking my existing framework as I have widely used switch statements
Here is example code
var $env = "A";
_alert("Alert Working outside Switch");
switch ($env){
case "A":
{
_alert("A alert");
_logException("A LogException");
break;
}
default:
{
_alert("default Alert");
_log("default Log");
break;
}
}
Result
Starting script
_alert("Alert Working outside Switch") [110 ms] [06:29:09.317]
Logging exception: [38 ms] [06:29:09.355]
A LogException
Total Memory in JVM (Xmx) is: 247.5 MB;
Memory currently in use is: 17.77734375 MB;
Memory increment during this test is: 0 MB [1 ms] [06:29:09.356]
Stopping script
Answers
V5.0.4 should be available for download EOD Monday 10th June.
I am using Sahi Pro v5.1.2 and this still seem to be an issue.
Is there any other way to make this work?
In my case I want to use _navigateTo and _log within the switch/if and it does not work.
It is currently just working outside the function.
function sName($sStuff, $sSite)
{
switch ($sStuff)
{
case "facebook":
if ($sSite == "NO")
{
_set($sURL,"https://google.com"
_navigateTo($sURL);
}
else
{
_set($sURL,"https://yahoo.com"
_navigateTo($sURL);
}
break;
default:
if ($sSite == "NO")
{
_set($sURL,"https://www.linkedin.com/"
_navigateTo($sURL);
//return $sURL;
}
else
{
_set($sURL,"https://twitter.com/"
_navigateTo($sURL);
//return $sURL;
}
break;
}
return $sURL;
}
$Name = sName("facebook");
_log($Name);