Forum Discussion
Object Explorer Hierarchy:
Sys.Process("abc").SwingObject1(some property,value).SwingObject2(some property,value)
Now SwingObject2 has two childs, SwingObject2.1(some property,value) and SwingObject2.2(some property,value)
I want to fetch all childs of SwingObject2.1 (lets say it has 5 direct childs and I want to get SwingObject2.1.2) above through iteration or something.
l = Sys.Process("abc");
ll = l.SwingObject2("some ClassName", "value",index , WndIndex);
lm = ll.FindAllChildren("JavaFullClassName","value of the class of the SwingObject2.1.2 ",10);
if(lm.length>0){
Log.Message("length exist");
Log.Message(lm.FullName);
}
}
else {
Log.Message("else")
}
Is this the right way to iterate through swing objects? And I don't know how to find indexes in Object Tree, I'm sorry I am new to Test Complete.
Thanks
Hi,
> instead of showing FullName it showing empty list.
.FindAllChildren() returns an array of found objects.
In your code (lm.FullName) you are trying to get the value of the .FullName property of the array. As the array does not have FullName property an empty value is returned.
Documentation for .FindAllChildren() method provides an example with the iteration through the resulting array. Check it and I hope that it will help.
As an example, modification of your code (JavaScript):
if(lm.length>0){
Log.Message("length exist");
for (let i = 0; i < lm.length; i++) // iterate through the array
Log.Message(lm[i].FullName);
}
Related Content
Recent Discussions
- 3 hours agoSvetaG