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.
Facing problem with assertions and if statement
Hello Everybody,
I am facing one scenario where I am currently stuck and I need help from you guys. The scenario is as mentioned below. There is a login page with username and password text boxes.
Script steps:
1. Enter correct username
2. Enter incorrect password
3. Click Login button
4. Step 4 verifies that if logout is present then login is succesful and click logout and if logout is not present then means login failed
I tried using assertions as condition in if statement but it didn't worked (later on I found on forum that we should not assertions). To make matter verse the logout button is present on a popup.
So I am not able to figure out a way for this scenario.
Thanks in advance,
Sumeet
I am facing one scenario where I am currently stuck and I need help from you guys. The scenario is as mentioned below. There is a login page with username and password text boxes.
Script steps:
1. Enter correct username
2. Enter incorrect password
3. Click Login button
4. Step 4 verifies that if logout is present then login is succesful and click logout and if logout is not present then means login failed
I tried using assertions as condition in if statement but it didn't worked (later on I found on forum that we should not assertions). To make matter verse the logout button is present on a popup.
So I am not able to figure out a way for this scenario.
Thanks in advance,
Sumeet
Comments
So this post is finally dead, hence closing it!!!
Regards,
Sumeet
Don't use assertions and error handling in this case.
An example script for you would be
Regards,
Narayan
Thanks for the script. Well I have one question, is it mandatory to make use of _set() api in order to assign value of a condition (in my case it is _isvisible()). As I found that when I used an assignment operation (=) the value was not assigned.
Below is the script which I used before using the _set api
var $val=false;
$val = _exists(_link("About Google"));
but $val retained its value of false, later when I used _set() api things worked.
Kindly let me know, is this as per design?
Regards,
Sumeet
Yes _set is required in this case (till the next release).
The reason is that the script executes in the Proxy and _set helps fetch values from the browser to the proxy.
Regards,
Narayan
Nice enhancement ( I meant fix
Regards,
sumeet