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.

An issue in clicking one on a popup

SPSP Members
edited November -1 in Sahi - Open Source
Can anyone help me to resolve this issue. I am not able to click on a popup. This is the Js function corresponding to that popup

OS: Windows Xp
Browser: Firefox 9
sahi 3.5

window.onbeforeunload = function() {
return "Data will be lost if you leave the page, are you sure ?";
};

I am not able to click on this popup.

Regards,
SP

Comments

  • Hi SP,

    Why not try with _expectConfirm API.Go through the following link

    http://sahi.co.in/w/_expectConfirm

    This might help you.

    Regards,
    Theeran.
  • SPSP Members
    I have tried using _expectConfirm. It didn't work for me. I have forwarded the popup details and and the sahi script I wrote to Narayans mail id last week.

    Waiting for response

    SP
  • narayannarayan Administrators
    Theeran and SP, _expectConfirm is only for window.confirm dialogs. It will not work here.
    This is a tricky dialog box. One work around I can suggest is to remove the onbeforeunload before you click on the button which unloads the page.

    Like this:

    _call(window.onbeforeunload=null);
    _click(_button("Submit")); // or link click that triggers the page unload.

    Regards,
    Narayan
  • SPSP Members
    Thanks Narayan. The issue is resolved now

    Regards,
    SP
This discussion has been closed.