Forum Discussion

tengel's avatar
tengel
Contributor
12 years ago

Intermittent Objects Not Found

I am running scripts and intermittently objects will not be found.  They may be found over a hundred runs but suddenly they are not found.  I've put in a delay as followsand then it will run.  Sometimes I've had to use a 2000 delay because the problem returns on a later run.


var QuickSearchIcon = Aliases.browser.pageMaximoItemMaster....QuicksearchFindimage;



Delay(1000);



QuickSearchIcon.Click();



How can I get this to stop?


  • Grant,



    Is there a way to determine how long it is taking to find a container? I would like to monitor this and determine what objects are causing the problem, and then maybe I can come up with a solution.  Right now it seems like I am shooting in the dark too much of the time.
  • Is there a way to universally wait for objects to be found before trying to click on them or otherwise use them?  I really do not want to have to add a wait loop or property on every object I am accessing.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    By default, when TestComplete attempts to interact with an object, it will wait a specified amount of time based upon the Default auto-wait timeout as specified in your project properties.  See this link.



    This applies for NameMapping and other such options as well.



    For certain situations, though, the auto-wait may not be enough.  In those cases, your only recourse is to use a WaitNNN function.  Since you are using NameMapping, you might want to try WaitAliasChild whenever you are making a call to that object.
  • I'll try that, thanks.  Some of the previous ideas have worked, but I am working through 20 scripts with multiple objects with problems and the problem appears randomly. Whack-a-mole.  I need one solution that I can apply everywhere and be assured that this problem is solved.



    When TestComplete interacts with an application, does it affect the performance of the application?  
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Depends somewhat on the application and what interaction you're doing.  Some of the means by which TestComplete interacts with objects and properties requires the application to serve up some of that information, and therefore, impacts performance.  IMO, it's a decent payoff for the ability to drill into the system.
  • Is there a way to monitor performance impact and perhaps select alternative methodologies for drilling?
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Beyond just keeping track of memory consumption and processor usage during the actual test runs, I don't know of a specific way of doing so.  Sorry. :(
  • We are thinking that the problem may not be so much in forcing a wait to occur until the object is recognized as in forcing TestComplete to recognize the object. more efficiently. By eye I know the object is there but TC seems to not recognize it until seconds later.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    It's for that reason that WaitNNN and Find functions are best for looking for objects for which there is a delay... you can set the delay timers within those functions to something bug (like 60000 ms) which should cover a wide range of timing problems.  If the object returns sooner, the function will return sooner.



    Additionally, using WaitNNN and Find functions are actually recommended when doing any "Exists" test.  The reason being is that, if the object is not found and does not exist, those functions return an empty stub object with Exists = false.



    Anywho, hopefully you get it figured out.  Let us know if you need any further help.