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.
calling browser function of pop up
Hi all,
I am unable to call function of a popup.
_popup("popup name"._call(Browser_function()));
Am i using right code?
I am unable to call function of a popup.
_popup("popup name"._call(Browser_function()));
Am i using right code?
Tagged:
Comments
This is what i am using: _popup("popup name")._call("NewFunction()");
It shows me Playback success but i dont think worked. This NewFunction should perform couple of actions including showing of a alert message which is not happening.
_popup("popup name")._call(NewFunction());
If you want to use a string there, use
_popup("popup name")._eval("NewFunction()");
When i invoke NewFunction() it opens 2nd popup which sahi is unable to recognize. so what i am trying to do is close 2nd popup by calling a function from js for 2nd popup. (does anyone have some other workaround?)
Now the question is how can i do it? i have tried to _call(Close2ndpopup()) after putting js path in inject_top but i got no success.
popup1 opens popup2
1) If popup2's window handle is available in popup1, say in variable handleToPopup2
Use
_popup("popup1")._call(handleToPopup2.close());
2) If you do not have handle to popup2,
_popup("popup1")._call(window.open("", "popup2WindowName").close());
_popup("popup1")._call(handleToPopup2.NewFunction());
or
_popup("popup1")._call(window.open("", "popup2WindowName"). NewFunction());
Javascript functions are defined on the window object where the js executes, so if you have a handle to the window you can call window.functionName(parameters) to invoke the function.
what i think of a reason behind that is 2nd popup is created by another js.
so its like this: 1st popup creates a new handle which invokes a popupcreator.js which takes 2ndpopup.jsp as an argument and then creates that pop up. THe function which i want to call is in js of 2ndpopup.jsp (little bit complicated). so calling by handle is not working there.
Code from 1st popup which creates 2ndpopup
var Handle1 = new popupcreator("2nd Pop up", "2ndpopup.jsp?....
and function which i want to call is in 2ndpopup.js
so when i use _popup("popup1")._call(handle1.NewFunction()) it actually reffering to popupcreator.js(do correct me if i wrong)
I dont think we can do much here.