Forum Discussion
8 Replies
- jose_pitaSuper ContributorHow do you want to identify the parent? Isn't it easier to just use the Find function to find the parent?
Why do you use that getPropertyValue function? Isn't it easier to just
Log.Message(obj.tooltip)//if it throws an error do obj.tooltip.toString()
Code to get the parent:
var parent;
do
{
parent = yourObject.parent;
while(parent.name != "nameOfTheParent") - irina_lukinaSuper Contributor
Hi Saurabh,
or I just have to traverse thru loop to reach the exact parent?
You're absolutely right. You need to create a loop that will get the parent object of the current one and check the specified conditions for this object. If the object doesn't meet the specified condition, increase the counter value and repeat the iteration (get the parent object of the previously selected parent object), and so on. - murugans1011Regular ContributorHi does anybody hav implemented something like this??
- irina_lukinaSuper Contributor
Hi Saurabh,
All processes, windows, controls and on-screen objects have the Parent property. This property returns a reference to the parent object of the current one.
Does this information help?
- saurabh1484ContributorThanks Irina. The information helps.
But using this property i can find immediate parent only. Is it possible to find the parent at any level or I just have to traverse thru loop to reach the exact parent?
I am using a WPF application, and when i am usingvar value=
aqObject["GetPropertyValue"](ObjName,"ToolTip") function, I am getting Junk value in the output.
Please see the attached snapshot. On doing a mouse hover on the log message, i can the exact value present in the tooltip(Available in the same snapshot)
Do you have any solution, so that i can get the same output what is present in tooltip. I assume this junk value in the output is a new line character which testcomplete is not able tor ecognize?
regards,
Saurabh - murugans1011Regular ContributorHi Can someone pls post the sample code to find parent object as irina suggested
- murugans1011Regular ContributorHi i can able to get only parent object. i knew somthing which gets grandparent lik
obj.parent.parent
but i need something lik which automatically counts no.of parents and need to search for supported property in that object
for example mapped name is
Aliases.ERPQuickLauncher.frmEquipmentEntry.Frame1.VBObject("Frame2").VBObject("ADE_attachments").VBObject("Frame1").VBObject("cmdSortA")
i need to find if any parent object support particular property
something lik
if aqobject.issupported(obj.parent, "gridMove") then
........
End if
but i didnt kw how to find no.of parent obj count implement in loop - mtsmithContributorThis example is from a Java SWT project:
//oTCControl is the child to start searching at and continue back up the tree looking for the first parent containing with a string value in the data field.
for (var i = aTCFullName.length - 1; i > 1; i--) {
if (aqObject.IsSupported(oTCControl,"JavaClassName") && oTCControl.getData() != null
&& oTCControl.getData().JavaClassName == 'String' ) {
sTemp = oTCControl.getData().OleValue;
sTemp = sTemp.replace(/ /g, '');
break;
}
oTCControl = oTCControl.Parent;
}
Related Content
Recent Discussions
- 40 minutes agoSvetaG