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.
How to use _lastConfirm() API
Hi!
How can i use _lastConfirm
to capture the message displayed on the Confirm pop up,
just like what Chejness asked in the previous posts.
For example:
As in the link in Sahi website for the "_expectConfirm" description:
click on the link: "Click for confirm dialog"
It displays: "This is an example confirm dialog. Get it?"
HOW CAN I CAPTURE THIS MESSAGE???
Thanks...
How can i use _lastConfirm
to capture the message displayed on the Confirm pop up,
just like what Chejness asked in the previous posts.
For example:
As in the link in Sahi website for the "_expectConfirm" description:
click on the link: "Click for confirm dialog"
It displays: "This is an example confirm dialog. Get it?"
HOW CAN I CAPTURE THIS MESSAGE???
Thanks...
This discussion has been closed.
Comments
Use :
var $a = _lastConfirm();
_alert($a);
_lastConfirm() API is used to get the text of the last occurred confirm dialog.
Regards
Sumitra
i'm new to web automation and i'm a beginner in using sahi..
i dont know how to apply what you've said...
btw im just using sahi script...
my problem is...
how can i capture the error messge on the confirm popup?
for example,
the message in the popup was "Username must not be less than 8 characters."
and what if the message will change to, "Password must not be less than 8 characters." or "You have entered invalid information."
what should i do? do i need to set a variable for the error message so that whatever message it will show, i can capture it....
i realy need help plsss... thanks...
I wil explain you with a script which will help you to understand how _lastConfirm() works.
First of all you need to understand that the confirm dialog will not be visible during playback.If you want to capture the message in the confirm dialog then you just have to use _lastConfirm() API.
Here is the sample script:
You can run the above script and see what exactly is happening.
In the above script, _alert() API will alert the message which was there in the confirm dialog.
_debug() API will be visible on the window where the proxy is running unless redirected(Click on Logs on the Dashboard, here you can see the confirm dialog message).
If you want to get this message into a file then you can use _writeFile(text, filePath[, overwrite]); API.
Let me know if you have any doubts.
Regards
Sumitra
it helped me alot...now i know how to use that API...
one more question.
i have a new problem..
im testing a system that shows an error message which is not a popup window.. i think its just in a div.
Can you please be more specific about your second issue?
What is the error message you are getting? Are you getting this error on all browsers?
Regards
Sumitra
its okay now, ive figured out what my problem is..
ive just read the sahi manual,, and it answerd my problem...
at first, i just dont know how to use the alternatives in sahi controller,,
now i know because of the manual..
function verifyErrorMessage($msg){
_assert(_isVisible(_div("msg")));
_assertEqual($msg,_getText(_div("msg")));
}
thanks a lot for your help...