Solved
Forum Discussion
tristaanogre
9 years agoEsteemed Contributor
As far as I can tell, there's not a really easy way to pass an array in as a parameter to a script routine via a keyword test. So, what I did is do a little detection within the function itself to determine if the parameter being passed is a string or if it is an array. If it is a string, then use the eval function to convert to an array. If it is not a string, I'm assuming it is an array. Your function code would look something like this:
function findObject(mType,mFieldName,mObject) { var myObject; var depth = 10; Sys.Refresh(); if (typeof mType == 'string') { mType = eval(mType); } if (typeof mFieldName == 'string') { mFieldName = eval(mFieldName); } if(mObject == null) { mObject = Sys.Browser("iexplore").Page(getURL()); depth = 20; } myObject = mObject.Find(mType,mFieldName,depth,false); if(myObject.Exists == true) { return myObject; } else { Log.Message("The object with the " + myFieldName + " parameters was not found"); return null; } CollectGarbage(); }
akalogeropoulos
9 years agoOccasional Contributor
Thank you, it worked.
Best regrads,
Anastasios