18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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 check if a popup exists?
I tried with both _isVisible and _exists, both failing with Window/Domain not found.
var $condn;
_popup("Page 2")._set($condn, _exists(_popup("Page 3")._image("Image.gif")));
if ($condn) {
PageExistDoSomething();
} else {
PageDoesNotExistDoSomethingElse();
}
var $condn;
_popup("Page 2")._set($condn, _isVisible(_popup("Page 3")._image("Image.gif")));
if ($condn) {
PageExistDoSomething();
} else {
PageDoesNotExistDoSomethingElse();
}
var $condn;
_popup("Page 2")._set($condn, _exists(_popup("Page 3")._image("Image.gif")));
if ($condn) {
PageExistDoSomething();
} else {
PageDoesNotExistDoSomethingElse();
}
var $condn;
_popup("Page 2")._set($condn, _isVisible(_popup("Page 3")._image("Image.gif")));
if ($condn) {
PageExistDoSomething();
} else {
PageDoesNotExistDoSomethingElse();
}
Comments
Is there a reason why it uses both "Page 2" and "Page 3"?
The right way to do it is like this:
_popup is a marker to execute a particular piece of code on another window. It is to be used only at the start of the command. We are trying to simplify this and make it more intuitive, but currently, you need to use _popup only at the start of the command.
Regards,
Narayan
By not having it as prefix as well as condition check, Sahi is confused as to which window to look for.
From the Portal, I launch 'App2-Page2' , it then automatically launches 'App3-Page3' popup.
So at this point, I need to do a _isVisible or _exists of an image of 'App3-Page3', if it does not exists, I need to force it to launch...see code below.
/* ---- Code
*/
launchFromPortal (App2-Page2-Link);
Perform_App2-Page2_operations ();
//At this point App2-Page2 will automatically launch App3-Page3 due to some other condition
var $condn;
_popup("App2-Page2")._set($condn, _exists(_popup("App3-Page3)._image("Image.gif")));
if ($condn) {
App3-Page3_AutomaticLaunch_WORKED();
} else {
App3-Page3_AutomaticLaunch_FAILED();
App3-Page3_ForceLaunch_INSTEAD();
}
I hope this helps.
Thanks,
RJ