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.
Storing a reference to a popup in a variable
Hi,
I'm trying to figure out a way to store a reference to a popup, but so far I've not been able to figure out how to do so.
What I would like to do is something along the lines:
In the above case $pop will be undefined even though _popup('popupName'); does find the popup. Calling _popup('popupName')._someSahiMethod(); does work, but that's not really as DRY as I would like it.
Is it possible at all to store a reference to a popup? If so please let me know how
Thanks in advance!
- Peter
I'm trying to figure out a way to store a reference to a popup, but so far I've not been able to figure out how to do so.
What I would like to do is something along the lines:
function getPopup() {
return _popup('popupName');
}
var $pop = getPopup();
$pop._doSahiStuff();
In the above case $pop will be undefined even though _popup('popupName'); does find the popup. Calling _popup('popupName')._someSahiMethod(); does work, but that's not really as DRY as I would like it.
Is it possible at all to store a reference to a popup? If so please let me know how
Thanks in advance!
- Peter
Comments
You can do something else though. There is an API called _selectWindow(popupId). Have a look at _selectWindow() here: http://sahi.co.in/w/miscellaneous-apis
Regards,
Narayan
Don't know how I missed that.
It's not exactly what I was looking for, but it's working very well.
Thanks for helping out!
Cheers,
Peter
Cheers,
Narayan
On that note, are there any plans to restructure the API? I've been working with SAHI for a couple of weeks and I find the sectioning of topics on different pages a bit unintuitive and pretty hard to navigate (especially to search). I think having them all on one page is a better solution now.
Cheers,
- Peter
As an example the _log(), _wait() and all of the assertion methods could just as well be placed on the misc. page.
I really depends on how you use the API, but as a big fan of the browsers built in page search, having it all on one page would make sense
- Peter