Forum Discussion
tristaanogre
14 years agoEsteemed Contributor
Currently, Aliases cannot be defined and created in code. You'd have to use the NameMapping tool to map out your components ahead of time.
It's not that you cannot create an object repository in code, just that you'd have to wrap each item in a function to reference it, like below.
The point is that the object would then resolve upon calling the function. The code you posted earlier, the variables outside of the function need to resolve first... if you wrap them in functions like above, then you can do all your definitions in code and call them at will.
I'd suggest though that you liberally use code like FindChild, WaitChild, etc., in your code so that the code does the appropriate waiting until an object exists before it tries to get a reference to it.
A different tactic would be that, instead of creating objects like this or using name mapping, to liberally use FindChild and FindAllChildren within the tests themselves, specifically create wrapper routines that, given a parent object, you'd find any child object kind of like this
It's not that you cannot create an object repository in code, just that you'd have to wrap each item in a function to reference it, like below.
function participantEdit_participantUrl ()
{
return Sys.Process("iexplore").Page("*").Panel("container").Panel("pageCell").Panel("pageContent").Panel("content").Form("ParticipantSaveForm").Fieldset(1).Panel(5).Textbox("participantUrl");
}
The point is that the object would then resolve upon calling the function. The code you posted earlier, the variables outside of the function need to resolve first... if you wrap them in functions like above, then you can do all your definitions in code and call them at will.
I'd suggest though that you liberally use code like FindChild, WaitChild, etc., in your code so that the code does the appropriate waiting until an object exists before it tries to get a reference to it.
A different tactic would be that, instead of creating objects like this or using name mapping, to liberally use FindChild and FindAllChildren within the tests themselves, specifically create wrapper routines that, given a parent object, you'd find any child object kind of like this
function GetMyObject(ParentObj, PropertyArray, ValuesArray)
{
return ParentObj.FindChild(PropertyArray, ValuesArray, 10, true)
}
Related Content
Recent Discussions
- 15 hours ago