Forum Discussion

thebick's avatar
thebick
Occasional Contributor
3 years ago

FindChild and FindChildEx hang, even with timeout

Main point: FindChild and FindChildEx are hanging. They do not return, either quickly (for FindChild) or after the timeout (FindChildEx).

I can walk the object tree easily down to a level of Page. Below that are Panels and possible nested Panels, all ending in TextNodes.

In particular, I need to find TextNode(0) at the end of an unknown length (possibly 0) of nested child Panel(0)

 

The following *should* work (I'm using Python):

    curObj = page

    panel = curObj.FindChild("Name", "Panel0")   # FindChild ignores ( and )  # Find Panel0 (if it exists) in the Page

    while panel.Exists:     # recurse through any Panel0

        curObj = panel

        panel = curObj.FindChild("Name", "Panel0")

    textNode = curObj.FindChild("Name", "TextNode0")    # find TextNode0 at the end of the Panel0's

    return textNode

 

But about 10% of the time FindChild hangs. Even FindChildEx ignores the timeout and hangs.

If I close the window, FindChild (or FindChildEx) returns immediately.

 

So why is FindChild hanging? This is messing my tests royally.