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.

Test to see if Popup Window is available

MarkMark Members
edited July 2014 in Sahi - Open Source
I'm having great difficulty establishing whether or not a Popup window exists.
If the popup has not been created there seems to be no Sahi way of checking that it has not been created.

These all fail with the following Error message:

Window/Domain not found: popupNameFromStep=SF-42400000003 for FOA00000001; derivedName=; windowName=; windowTitle=Sahi Start; wasOpened=0; domain=
--Stopped Playback: FAILURE--

And in the log:

_debug(_popup("SF-42400000003 for FOA00000001").exists())
Window/Domain not found: popupNameFromStep=SF-42400000003 for FOA00000001; derivedName=; windowName=; windowTitle=Sahi Start; wasOpened=0; domain= at Jul 27, 2014 11:11:43 AM

Here are the ways I've attempted to check to see if a particular Popup window is available:

var $popupname = "SF-42400000003 for FOA00000001";
_debug($popupname);

var $exists = _popup($popupname).exists();
_debug($exists)

var $exists = _exists(_popup($popupname));
_debug($exists)

var $exists = _condition(_popup($popupname).exists());
_debug($exists)

var $exists = _condition(_exists(_popup($popupname)));
_debug($exists)

var $exists = _popup($popupname).isVisible();
_debug($exists)

var $exists = _isVisible(_popup($popupname));
_debug($exists)

var $exists = _condition(_popup($popupname).isVisible());
_debug($exists)

var $exists = _condition(_isVisible(_popup($popupname)));
_debug($exists)

Also, I've tried all the asserts.
I tried:
onScriptFailure($exception)
onScriptError($exception)

To try and workaround the failure to check if a Popup exists. No success!

Any help = much appreciated!

-Mark.

Comments

  • MarkMark Members
    If any of the moderators, or Sahi Gurus would like, I'd be happy to setup a Webex meeting to demo/trouble-shoot.

    -Mark.
  • Mark,
    Why don't you implement some kind of try catch stuff?
    Sahi is very good in try catch looping.
    We had a similar case in which after clicking a Done button, either a popup will come and you need to click on that and then the required page will load.
    Otherwise the required page will be loaded directly.
    In our JavaScript was checking for something in DB in background.
    try for var $popup = _popup("Title of Popup");
    if($popup!= null)
    do this
    else
    do that
  • Can you try this:
    var $Winexists = _windowExists($popupname, 1000)
    _debug($Winexists)
Sign In or Register to comment.