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.

check if _popup exits

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

does anyone know if you can check if a pop-up is loaded.

if want to-do this before a button click, for example

if (_popup($tab1) == null) {
_click(_image("LoadTab1"));
} else {
_popup($tab1)._click(_image("Logout"));
}

at the moment i get the following error:
org.mozilla.javascript.EcmaError: TypeError: Cannot find function _popup. (<cmd>#31)

Comments

  • I believe that's a bug in Sahi V2.

    Try using the 06282008 version of Sahi.
  • narayannarayan Administrators
    I don't think so.

    A couple of points:

    1) _popup is not to be verified like that, because it will throw an exception if the popup is not found.
    2) The if condition will need a _condition because you are checking for stuff on the browser.


    Try this:
    <browser>
    function checkPopup(name){
         try{ return _sahi._popup(name);}
         catch(e){return null;}
    }
    </browser>
    
    if (_condition(checkPopup($tab1) == null)) {
       _click(_image("LoadTab1"));
    } else {
       _popup($tab1)._click(_image("Logout"));
    }
    
Sign In or Register to comment.