Forum Discussion

savio_leitao's avatar
savio_leitao
Occasional Contributor
13 years ago

FindChild is taking time to get the results


"A tip to add then is also to make sure that you supply enough properties and values to NameMapping or FindChild to be able to pick out the specific object you want out of all the


objects in the tree, especially if there are several that are similar."


 


Hi 


Is there any other alternative to make this faster,


I am working of a wpfpivotgrid and trying to find out ScrollableAreaCell based on 


ValueItem.RowIndex and ValueItem.ColumnIndex


 


var cell = NavFind.FindChild(this.pivotGridControl, new Property[] { 


                new Property(Prop.ClrFullClassName, FullClass.ScrollableAreaCell),


                new Property("ValueItem.RowIndex","0"),  


                new Property("ValueItem.ColumnIndex","0"),                       


                new Property(Prop.IsVisible,true.ToString())});


 


Its taking about 5 seconds to come up with a result


any pointers?

7 Replies


  • Hi Savio,


     


    There should be a control's special method or property for this. Did you try to look for it in the control documentation?


     

  • savio_leitao's avatar
    savio_leitao
    Occasional Contributor
    Hi Tanya,



    When we use in findChild


    new Property("ValueItem.RowIndex","0"),  


    new Property("ValueItem.ColumnIndex","0"),       



    "ValueItem.RowIndex" if the property to access is at 2 levels it takes a while to get the object.



    Regards,

    Savio

  • From my usage experience, any code based on Find or FindChild always will take a prohibitively long time to run. In my cases it was easily 10-15 seconds. It's not very feasable as something to rely on extensively.



    I think what Tanya was suggesting is instead of trying to use Find with your known values of RowIndex 0 and ColumIndex 0, you could use a method belonging to your grid that returns cells based on the row and column, like pivotGridControl.GetCellValue if it is supported on your grid.
  • chicks's avatar
    chicks
    Regular Contributor
    I'm using find and  FindChild extensively, typically specifying objecttype and a unique parameter such as id string, namePropStr



    e.g.

    function memberPortal_Panel_RetailerAds() { return memberPortal().findChild(new Array("ObjectType","idStr"),new Array("Panel","teamRetMem"),FIND_DEPTH) } ;



    My experience has been that it does not take "too long" however, it does seem like it takes longer than it 'should' e.g. 2-3 seconds to find a login button !!



    I've been wondering whether namespace mapping is faster or if there's a way to speed things up.



    I do NOT use row index or column index as a find property ever.  I try to access the table and then specify the cell rather than using a find.



  • Curt, if it is of any help to you, the automation framework I've been working with in TestComplete gives some rough comparisons.



    We have assigned a NameMapping and short Alias to about everything in our application under test, but we have some constraints we implemented against that required adding specific abstractions between our tests, the AUT, and the automation tool.



    Because of those constraints we adopted, when we need to retrieve an object, sometimes we have an exact representation of the mapped Alias a test needs (like "Foo" and "Bar" for "Aliases.Foo.Bar") and sometimes we only have part of the information (like the same "Foo" and "Bar" for "Aliases.Foo.Alpha.Beta.Tau.Bar").



    FindChild using the MappedName property with a wildcard (the representation of the Alias on each object) will work for either case, but as mentioned before it takes 8-15 seconds to return an object. Using "WaitAliasChild" returns my objects within a second - fast enough that we always try that approach first and failover to FindChild if unsuccessful.
  • savio_leitao's avatar
    savio_leitao
    Occasional Contributor
    Thanks Curt and Andrew for your replies.



    I need to know the Top property of the xtraPivotGrid, and getCellInfo only returns the value of the cell and not the actuall object so as to get the Top value, so cannot use any of the methods.



    Dont know if there is any other way?



    Regards,

    Savio
  • chicks's avatar
    chicks
    Regular Contributor
    Can you post the object spy results for the grid?