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.
Not Able To Click On Confirm
//There is confirm with text "confirm that you want to leave"
//With Two Buttons "Leave Page" and "Stay On Page"...........
//Tried :: Is There Any Other Way Than this (I HAve Been thru History Posts)
_expectConfirm("confirm that you want to leave", true);
_click(_link("Log off")); //..........................AFTER THIS CONFIRM APPEARS
_button("Leave Page").click(); //ERROR
_expectConfirm("confirm that you want to leave", true); //null
_button("Leave Page").click(); //ERROR
_expectConfirm("confirm that you want to leave", false); //null
_assertEqual(_lastConfirm(), "confirm that you want to leave"); //null
_assertEqual("Did you get it?", _lastConfirm("confirm that you want to leave")); //null
//Help ..............................................
//With Two Buttons "Leave Page" and "Stay On Page"...........
//Tried :: Is There Any Other Way Than this (I HAve Been thru History Posts)
_expectConfirm("confirm that you want to leave", true);
_click(_link("Log off")); //..........................AFTER THIS CONFIRM APPEARS
_button("Leave Page").click(); //ERROR
_expectConfirm("confirm that you want to leave", true); //null
_button("Leave Page").click(); //ERROR
_expectConfirm("confirm that you want to leave", false); //null
_assertEqual(_lastConfirm(), "confirm that you want to leave"); //null
_assertEqual("Did you get it?", _lastConfirm("confirm that you want to leave")); //null
//Help ..............................................
Answers
Your script looks incorrect
_button("Leave Page").click(); //ERROR
Correct One:- _click(_button("Leave Page"));
Please refer this for more info ( http://sahi.co.in/w/_expectConfirm )
Good Luck !!
You can use native events to send Enter key on the confirm button.
Could you please give an example of native events to send Enter or ESC key?