Forum Discussion

mrouse's avatar
mrouse
Contributor
13 years ago
Solved

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 the requirement for the wait statement but I am having trouble knowing which wait method to use or where to use it in my script.



The following is my line of code:



 if (Aliases.iexplore.pageEmds.panelFullwindow.panelMaincontent.textnodeAppswitchw.textnodeSchedule.Exists)

   {    

        <code here>



    }



Should I put the waiting statement on the front of the "textnodeSchedule.Exists".  similar to "waittextnode(Schedule, 10000).Exists"



Any help would be HUGELY appreciated.



Thanks,



Mike





  • 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.

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    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.
  • Martin,



    Thanks for your reply.  I just had the chance to try your suggestion and you were absolute correct.  Thanks for helping me out.



    This was a road block for my test development.  Everything else worked except this one if statement but it was pivotial.



    Thanks again,



    Mike