Forum Discussion
Hi,
> I am not able to fetch these two objects.
Any more details? Your code? Error message? What line of code throws the error? Screenshot of Object Browser with one or both objects that you'd like to find? Anything else that can help others to understand what you have tried and what exactly does not work for you?
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
- AlexKaras4 years agoChampion Level 3
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);
} - TestQA14 years agoFrequent Contributor
I want to add that it's not throwing error, but instead of showing FullName it showing empty list.
Related Content
Recent Discussions
- 2 hours agoSvetaG