Preetha
6 years agoOccasional Contributor
Solved
how can we pass an object defined in one unit to another
how can we pass an object defined in one unit to another in java csript.
I have imported the unitA(where the object is declared) in Unit B where i need to use the object.
- 6 years ago
Hi,
You need to return required value from the function like it was advised by Vinicius.
Like this:
//OpenFB unit
function openurl()
{
var browser;
var page;
Browsers.Item(btChrome).Run("https://www.facebook.com/");
browser = Sys.browser();
page = browser.Page("*facebook.com*");
// page.NativeWebObject.Find("name","websubmit","BUTTON").Click(); this code is working when executing from unit OpenFBreturn page; // <== added line
}//Unit B
//USEUNIT OpenFB
function mandatory_check()
{var page;
page = openurl(); // <== OpenFB. is not required because of //USEUNIT OpenFB directive
page.NativeWebObject.Find("name", "websubmit", "BUTTON").Click();
}