How to perform cross reference of variables in script formation
@: How to perform cross reference of variables in script formation
Eg: I am automating Login page and in that in Unit1, I initialize Browser Script just to open the browser and go to the URL of the Login form and the value to the Login Object from Unit1 as:
//USEUNIT Login_Form
function Login()
{
var browser;
var url = "http://............./VPortal";
var form, form1;
Browsers.Item(btChrome).Run(url);
page = Aliases.browser.page1921681224SsoLoginIvssoservi;
form = page.formLoginform;
LoginObject("admin","admin");
form.table.cell.Click(13, 6);
form1 = Aliases.browser.page1921681224VportalMgtconsoleA.frameTopframe.link.Click();
page.Wait();
browser.page1921681224VportalMgtconsoleA.frameTopframe.link.Click();
browser.page1921681224SsoLogoffIvssoserv.Wait();
}
In Unit2, I initialize login credentials and want to pass the values which is defined in Unit1 (Call by Value) to the textboxes (usename,password) initialized in Unit2 as:
function LoginObject(strUserName, strPassword)
{
var textbox;
var passwordBox;
//Call Delay(20000);
// textbox =Textbox("login");
textbox = form.textboxUsername;
textbox.Click();
//textbox = Aliases.browser.page1921681224SsoLoginIvssoservi.formLoginform.textboxUsername.MappedName;
textbox.SetText(strUserName);
passwordBox = Login.form.passwordboxPassword;
// passwordBox.SetText(strPassword);
How will I proceed to validate this scenario?
Help will be appreciated. If you have better example to do this please suggest also.
Thanku Sir,
I got the solution :- I pass the value to the function defined in another form as:
LoginObject("admin","admin",form);