Forum Discussion

mrouse's avatar
mrouse
Contributor
13 years ago

Wait object exists?

Hello all, I have read a lot of info, here in the forum,  about the issue with checking for the existence of an object but if the object doesn't exist there is no Exists method.  I understand t...
  • tristaanogre's avatar
    13 years ago
    Well, first of all, there's no such method as "WaitTextNode". :-)



    There's a list of WaitNNN methods in the help file for TestComplete.  If you go to http://support.smartbear.com/viewarticle/16980/ and expand it and then go to the "W" listing, you should see most of the WaitNNN methods available.  There are some few others that are dependent upon other objects but you can easily find them by simply searching for "Wait" in the help.



    Essentially, you'll be selecting the Wait method that makes most sense for how the objects are being recognized by TestComplete.



    In your case, you have everything mapped out to aliases.  This means that a good wait method to use is the WaitAliasChild.



    So, your code would be changed to something like this:



    if (Aliases.iexplore.pageEmds.panelFullwindow.panelMaincontent.textnodeAppswitchw.WaitAliasChild("textnodeSchedule", 20000).Exists)



       {    



            <code here>







        }




    This will effectively wait for 20 seconds until the object exists.  If it comes back before 20 seconds, it will return a "True" on Exists without waiting the full 20.  If it doesn't return after 20 seconds, Exists will return as "False" and the object returned will be an empty "stub" object with, effectively, nothing but the "Exists" property.