googleid_118035
11 years agoContributor
What is the best approach for scripting with name mapping or without name mapping?
Hi, I just whant to clarify that I am using system full path which mapped to an object and not using name mapping option at all. Some time my scripts get fail due to object identificatio...
- 11 years agoI set-up a script that acts as an "object repository" and define all the objects as functions, like this:
var testBrowserType = "iexplore";
function mpPortal_Link_FAQs(){return WaitForAndReturnTheObject(Sys.Browser(testBrowserType).Page("*"), new Array("ObjectType", "innerText"), new Array("*Link*", "*FAQs*"), 99);}
//wait 5 seconds if page and object load time doesn't sync properly with page.Wait()
var objWaitTime = 5;
function WaitForAndReturnTheObject(page, attribs, vals, depth, waitTime)
{
var object;
var theWait = 0;
if(waitTime != null)
theWait = waitTime;
else
theWait = objWaitTime;
for(var i = 0; i <= theWait; i++)
{
object = page.Find(attribs, vals, depth);
if(object.Exists)
{
return object;
}
else
if(theWait > 0) Delay(1000);
}//end for
try
{
Log.Error("Object not found! " + attribs[0] + ": " + vals[0]);// + ", " + attribs[1] + ": " + vals[1]);
}
catch(e){}
return object;
} //end WaitForAndReturnPageObject(page, attribs, vals)