Ask a Question

Wait object exists?

SOLVED
mrouse
Contributor

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





1 ACCEPTED SOLUTION

Accepted Solutions
tristaanogre
Community Hero

RE: Wait object exists?

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.

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

2 REPLIES 2
tristaanogre
Community Hero

RE: Wait object exists?

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.

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

mrouse
Contributor

RE: Wait object exists?

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 
cancel
Showing results for 
Search instead for 
Did you mean: