Forum Discussion

okin's avatar
okin
Occasional Contributor
4 years ago

WaitAliasChild taking minutes when Object does not exist

I am trying to use WaitAliasChild to check whether an object exists or not. When it does exist it finds its normally and quickly. However when it does not exist it seems to take around 2 minutes to resolve saying it is waiting for the object regardless of what timeout time I put into it. I know the parent object that I'm calling it on does exist at the time of it running, and the child I'm looking for is also a direct child, but I'm not sure why it would take so long. Is there a reason for this that I might not be seeing?

8 Replies

  • here is the feedback i've gotten (disclaimer, not my words) okin Marsha_R 

    ------------------------------------------------------------------------

    How the waitXXX methods work: they try to find object on some level during the timeout, if they have spare time left from timeout, they make one more loop.
    So, if timeout 1 minute, but for compare all object with properties on that level consume 30 sec. it will have 2 iterations before say that there is no such object (30 * 2 = 1 min). But if user asks TC to wait only 10 sec/ it still need to check the object at least once, so it will be 30 sec.
    But the question is why it consumes 2 minutes in user example.What we can suggest:

    1. Put intermediate levels into NameMapping tree (remap object with additional levels) (Aliases structure can be the same, only NameMapping tree is important for performance). Ideally to find closest stable and meaningful parent object  and perform WaitAliasChild from it
    2. Optimize the properties set (it's most difficult and non-trivial thing)
    3. Remove the object inside NameMapping (! not Aliases) tree, and remap it via new "Map the object using CSS and Xpath selectors" 
    • okin's avatar
      okin
      Occasional Contributor

      1. Would changing the name mapping have an effect if I am looking for a direct child though? While the mapping isn’t full on the parent object, it finds the parent object with no issue. However it is the direct child of the object I am calling WaitAliasChild on or even WaitNamedChild on. So wouldn't any extra name mapping only help if there was a deeper hierarchy between the object I am looking for and the object I am calling the wait on? Which is there is no deeper level in this case.

       

      For instance if I had object hierarchy of A B C D E F I am calling C.WaitAliasChild() to find D, but say I did not have B mapped it shouldn’t affect it in this case I would think since wouldn't it only check anything after C? Or in the case of non-existence does it ignore the hierarchy of C and check other parts of the document or the entire thing.

       

      2. By that does that mean the name mapping properties? At the very least between the name mapping hierarchy and the selected properties it is definitely unique. I also tried adding some more properties but that doesn't seem to change anything.

       

      3. Cant actually try this one since since I am using an older version of TestComplete so can’t speak for it.

       

      Also since In the name mapping I dont have extended find enabled isn't it effectively spending those more than 2 minutes just checking maybe 8 or so objects over and over? Or would it also ignore that and check all levels under the object.

    • okin's avatar
      okin
      Occasional Contributor

      I've tried both, no matter what time I put it still takes a little over 2 minutes. Even with -1 supposed to be setting it to the default wait time which is 10 seconds in my case.

  • okin's avatar
    okin
    Occasional Contributor

    Also after some more testing it seems to take around 45 seconds in Internet Explorer (while the 2ish minutes happens in Chrome). Also the wait time does seem to have an affect but only if you make it longer than those times and even then it seems to be a bit off.

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    I remember having this happen at my previous job but I don't remember what we did to fix it.  ðŸ¤”

     

    hkim5 any ideas?

  • which property of the child alias are you setting within the parameters? I remember vaguely that Exists property is not recommended for some reason, and that may be the core issue (even though it still does not explain why it hangs over the designated time period). Let me ask internally Marsha_R  okin 

     

    edit: i was thinking of another one of those waitXmethods ill still ask around

    • okin's avatar
      okin
      Occasional Contributor

      Even if I don't check for the exists property it doesn't seem to affect the time it takes so Im not sure if that would be the issue. Would you recommend using a different waitX method to check for an objects existence then though?