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.

how to handle asynchronus events ?

vikkyjainvikkyjain Members
edited November -1 in Sahi - Open Source
Hi,

I m new to sahi. I want to handle asynchronous event in my script.

Description - I am having page in which some time a pop up window come which is asynchronous, I want to click on cancel when it come, but by default click on OK.

Please help regarding this

Comments

  • SumitraSumitra Members
    Hi vikkyjain,

    Sahi by default acts as if “OK” was clicked when a confirm dialog comes up.

    It is possible to make the confirm return as if it was cancelled by setting

    _expectConfirm(label, false);


    Regards
    Sumitra
  • vikkyjainvikkyjain Members
    edited May 2011
    Hi Sumitra,

    Thanks for your response.

    But my basic need is to change default value of click.
    I want Sahi should click on "Cancel " by default. because
    In my application basically Confirm dialog may appear any time, when it click on ok automatically , application get reset and test case intruppted. So I cant use _expectConfirm() in my test case because We dont know that when Confirm dialog will appear, So i want when ever a confirm dialog open, it click on cancel button by default.



    Thanks & Regards
    Vikky
  • javaGurujavaGuru Members
    I think Vikky's use case is similar to my post "Handling asynchronous confirm popup"

    I was also unsuccessful while trying to cancel a popup (confirm) if the event is asynchronous.

    For e.g my server code generates these pop-ups randomly without any event from the client itself. In this scenario, if on my client a sahi script is executing a sequence of tests, it confirms my popup (OK) while actually i want it to cancel.

    I tried adding expectConfirm in many places but it works only if the confirm is in response (synchronous) to some event which is not true in my case.
Sign In or Register to comment.