Forum Discussion

aditya_nerkar's avatar
aditya_nerkar
Occasional Contributor
13 years ago

FindAllChildren isn't able to find all the elements. Looks like the object repository isn't refreshed.

Hi,

I have a WPF app whose elements are dynamically created.

I am using the FindAllChildren method to find all these elements.



// ----code---

function getChildren()

{

  PropName = new Array("ClrFullClassName");

  ValueName = new Array("DevExpress.Xpf.Docking.LayoutPanel");

var children =  Sys.Process("MyUIProcess").WPFObject("HwndSource:self").WPFObject("self").FindAllChildren(PropName,ValueName,20,true);

}

//--endCode---



The FindAllChildren call seems to be dodgy. It's able to find only a sub set of the children.



It's only when I use the object explorer and actually highlight the remaining elements that the findallchildren method is able to find them. (in subsequent runs of the method)



Sys.Refresh() isn't helping either.



I am using TC 9.20

3 Replies

  • aditya_nerkar's avatar
    aditya_nerkar
    Occasional Contributor
    According to the TC docs,

    The Refresh parameter lets you specify what TestComplete should do if no objects matching the search criteria were found in the cached object tree.If it is True (default), TestComplete will refresh the cached object tree and perform the search once again.



    Does this mean, TC will do a re-search ONLY if an empty array is returned?



    What if it returns a list but not the entire list? Will the refresh=true paramter be ignored in this case?