FindChild method finding one child object but not finding the rest of the child objects
My tested application uses a dynamically built menu. If 7 manuals are installed, it displays 7 items, if 6 are installed it shows 6, and so on. TestComplete is mapping the menu items the same way each time the application is run.
They all get mapped under an object called "SectionLibrary" in NameMapping.
Here is a trunctated inheiritance tree:
- panel (Vehicle Type, this object FindChild locates perfectly)
- panel (Manual Type, this FindChild does not seem to locate)
- Panel (Specific vehicle, have not gotten this far yet)
On screen, renderd as a nested menu, it shows as
- Manual Type
- Specific Vehicle
For Vehicle Type, it returns an object of Width X and Height Y, clicks on it fine, and this brings up the next level of the menu. The level in the menu chokes it.
propArray = new Array("contentText", "ObjectType"); valArray = new Array("Truck","Panel); object = sectionLib.FindChild(propArray, valArray,7); object.Click(); // This works perfectly. valArray = new Array("23*", "Panel"); object = sectionLib.FindChild(propArray, valArray,10); /* This returns an object of dimensions 0x0, but does not appear to be the same object
Object Spy returns from the screen. */
Solved! Go to Solution.
FindChild finds the FIRST object that matches the criteria, working from the bottom of the tree up. So, it found exactly what you suggested... but not the one you were looking for. You may need to expand your property array and value array to include additional criteria. You might also want to consider starting further down the tree rather than from sectionLib.
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider