Forum Discussion

harshad_w's avatar
harshad_w
Occasional Contributor
5 years ago
Solved

FindChild method is not working in iterations

function openRoadCommonFunctions_sideOfCL(sideOfCL) { try { var hostForm = Aliases.OpenRoadsDesigner.HostForm; var listItemsObj = Aliases.OpenRoadsDesigner.DropD...
  • AlexKaras's avatar
    AlexKaras
    5 years ago

    Hi,

     

    Well, you did not mention language/technology your tested application is based on and if it uses some non-standard controls or the way how they are filled with data, the code might have sence...

    Nevertheless, I would recommend to replace search loops with the call to .FindChildEx() or .WaitAliasChild() whatever is more appropriate.

    The potential problem with search loops that are based on the objects referred to via Aliases is that for performance reasons TestComplete caches such objects and may not always update their state. This means that if for some reason aliased object was not found when it was referenced and used for the first time, the reference to the empty object might be cached and used within the search loop. Even if the sought for object will appear later while the code is within the loop.

    .FindChildEx() should handle the above problem.

    Also you may consider to use the .RefreshMappingInfo() method. At least I would strongly recommend to read its description to get a better understanding about the things I mentioned above.