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.
sahi if condition
hi Every one i am new to sahi and to automation testing
i am using a if condition to logout
if the user name matches then i should logout.
i use the below code to do that
if (_condition((_assertEqual("dmt Testingq", _getText(_span(11))))))
{
_click(_link("Logout"));
}
but when i ever i playback i see the below entry in the logs and it fails
_sahi.saveCondition("__lastConditionValue__0", (_assertEqual("dmt Testingq", _getText(_span(11)))))
Can any one please help me ......
i am using a if condition to logout
if the user name matches then i should logout.
i use the below code to do that
if (_condition((_assertEqual("dmt Testingq", _getText(_span(11))))))
{
_click(_link("Logout"));
}
but when i ever i playback i see the below entry in the logs and it fails
_sahi.saveCondition("__lastConditionValue__0", (_assertEqual("dmt Testingq", _getText(_span(11)))))
Can any one please help me ......
Comments
use if(_condition("text" == _getText(_span()))) {
if (_condition((_assertEqual("dmt Testingq", _getText(_span(11))))))
{
_click(_link("Logout"));
}
if (_condition((_assertEqual("dmt Testingq", _getText(_span(11))))))
{
_click(_link("Logout"));
}
will never work. If conditions require a boolean value
if ( true ) { } else { }
Please consider this http://sahi.co.in/w/_assertequal with a close view on the text in capitals at the bottom.
For getting this thing to work, you need a boolean expression. Please change your code as follows
if (_condition(( "dmt Testingq" == _getText(_span(11)))))
{
_click(_link("Logout"));
}