Forum Discussion
chicks
14 years agoRegular Contributor
Mike,;
I don't use the name mapping because it doesn't provide the level of control I'd like. What I do is have an objects file, with a function for each object I care about. The find function returns a stub object if the item is not found....
// here's the code in the actual t est
Click( memberPortal_Link_Logout() );
// here's the definition of the logout button
function memberPortal_Link_Logout(){return memberPortal_topPanel().Find(new Array("ObjectType", "innerText"), new Array("*Link*", "*Logout*"), FIND_DEPTH);}
// here's the Click routine, which handles the object not existing case
function Click(linkOrButton)
{
if(linkOrButton.Exists)
{
linkOrButton.Click();
Sys.Process("iexplore").Page("*").Wait();
}
else
{
Log.Error("Couldn't find object to Click.");
//throw exception;
}
}
Regards, Curt
I don't use the name mapping because it doesn't provide the level of control I'd like. What I do is have an objects file, with a function for each object I care about. The find function returns a stub object if the item is not found....
// here's the code in the actual t est
Click( memberPortal_Link_Logout() );
// here's the definition of the logout button
function memberPortal_Link_Logout(){return memberPortal_topPanel().Find(new Array("ObjectType", "innerText"), new Array("*Link*", "*Logout*"), FIND_DEPTH);}
// here's the Click routine, which handles the object not existing case
function Click(linkOrButton)
{
if(linkOrButton.Exists)
{
linkOrButton.Click();
Sys.Process("iexplore").Page("*").Wait();
}
else
{
Log.Error("Couldn't find object to Click.");
//throw exception;
}
}
Regards, Curt