18 January 2026:


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.

Confirm / Cancel javascript alert

JaoBrJaoBr Members
edited July 2012 in Sahi - Open Source
Hi,

I have an issue in dealing with this kind of javascript alert, the one discribed here: http://sahi.co.in/w/_expectConfirm when clicking in Click for confirm dialog.
Sahi by default acts as if "Ok" was clicked by the user, how can I make Sahi act as if "Cancel" was clicked?

I thought that the _expectConfirm API would do this, but I think that I didn't understood the real purpose of this API.

I just need to click in "Cancel", because I don't want the result of clicking in "Ok".

I'm using Sahi 2011-07-19 in IE9. OS: Win 7.

Thanks!

Comments

  • Hi JaoBr,

    You can use, _expectConfirm("Some question?", false); for Cancel button to be clicked.


    Thanks and regards.
  • JaoBrJaoBr Members
    edited August 2012
    Hi,

    The _expectConfirm should be used befero the action that triggers the alert right?
    It still doesn't work for me, here is the code:
    function executarNaoReal($i){
        _expectConfirm("Some question?", false);
        _popup(/mypopup.*/)._click(_button("Executar"));
    }
    

    It always click on Ok.
  • Hi JaoBr,

    for the _expectConfirm, you should place the real message on the confirm pop-up.
    "Some question?" is just my example.
  • JaoBrJaoBr Members
    Hi lonely_girl01,

    Thanks! I didn't knew that the massage should be the same of the confirm pop-up. It works fine now :)
Sign In or Register to comment.