Ask a Question

FindChild method finding one child object but not finding the rest of the child objects

SOLVED
alan-mullin
Occasional Contributor

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:

SectionLibrary

  • textnode
  • shadowroot
    • panel (Vehicle Type, this object FindChild locates perfectly)
    • textnode
      • shawdowroot
        • panel (Manual Type, this FindChild does not seem to locate)
        • textnode
          • shadowroot
            • Panel (Specific vehicle, have not gotten this far yet)

On screen, renderd as a nested menu, it shows as

Vehicle Type

  • 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. */
1 REPLY 1
tristaanogre
Esteemed Contributor

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.  


Robert Martin
[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
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: