Forum Discussion

Adagio's avatar
Adagio
Frequent Contributor
7 years ago

Object recognition is too slow

Hi,

I've an app which I'm trying to automate.

 

some of these controls are so deep inside the DOM, that the object mapping took in 10 minutes for mapping 1 object.

Problem was even worse while TC was trying to recognize that object. after 3 minutes,  It couldn't find that object.

 

I've tried the xpath approch as well, but even that didn't help.  Is there anything else that  I should try to get that working?

Any help would be appreciated!

 

Thank you

Abhi

  • There's another option in Tools | Options | Engines | NameMapping about "find visible objects first" or something like that.  Turn that off.  Having that on has TestComplete filter out objects with the "Visible" property set to "False" and, if it can't find the object as visible, it then goes back and RE-searches the object.  With that option turned off, the search is only done once.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    OK... first... Under Tools | Options | Engines | NameMapping there is an option "Use extended find when possible".  My recommendation is that this should always be turned off.  Extended Find is a useful feature but, if used too much, it can cause the problem you're experiencing.  We use Extended Find, but only when we really have to.

    So, after checking that, look at your NameMapping in the Mapped Objects panel.  Any objects that have the Extended Find option checked, you should consider whether it is strictly necessary.  Basically, if it has Extended Find check, there is an indepth search of the DOM that is done from the parent object down the tree, searching until it finds the object.  The deeper the object is in the DOM, the longer this search can take.  

    My recommendation: if something is marked with "Extended Find", after turning off the option mentioned above, map ALL the ancestor objects between the original parent and the target child.  Then drag that target child to be in it's proper place in the hierarchy and uncheck the "Extended Find" option.

    This is an "elbow grease" solution... and it's the best I've found.  I've already put in a feature request to have the "extended find" by default option turned OFF to prevent exactly what you're running into.  Again, if you NEED extended find for some reason, you can turn it on and off manually while mapping components but I wouldn't recommend using it for ALL mappings.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Keep in mind concerning XPath... it is also searching the full DOM... so, the more layers in the DOM, the longer it takes to search.  Properly mapped objects only search a select part of the sub tree and, if Extended Find is not checked, only search the immediate descendants.

      • Adagio's avatar
        Adagio
        Frequent Contributor

        Thanks Robert! I tried the suggested approach, but that didn't solve the problem.

        It's still taking a lots of time to get the mapping path of the object( for mapping). I deleted my old mapping and wanted to do it again, but no success. When I was trying to map it again, it took around 15 minutes to get me the mapping path, and asked me to map 28 objects before mapping this required object. 

         

        Even for xPath, I wrote it in a way that It didn't have to go thru evey single node in the tree. I used the Ids and that could have been faster, but that didn't help either. 

        Please let me know what you think.

         

        Thank you

        Abhi