What's the best way to wait for an object to be closed?
Hi, i've inherited some test cases and although they pass, I am getting the dreaded 'An object recognition hint' warning.
The code in question is waiting for an object to not exist before continuing:
// Wait until the template window is not shown anymore.
Rm_App["NewTemplate"]["WaitProperty"]("Exists",false,200000);
I'm guessing the WaitProperty method is not the correct method to use here and hence why I'm getting the warning, or maybe it is and I just need to add some code around it to utilise it properly?
So my question is what is the best practice to use in it's place to wait for an object to finish it's job and close before the test continues?
Notes: Code being used is C#Script, and i'm pretty new to the coding world so be gentle. :smileyhappy: TIA
I don't like using WaitProperty for the "Exists" property... if you think about it, the WaitProperty method is being called off the object you're looking to see if it exists. If that object does not actually exist, how you can call a method?
What I usually do for "wait for not exists" scenario us use WaitChild to find the object (or FindChild or something similar) and then check the exists property of the resulting object and then loop until it no longer exists.
Something like:
// Wait until the template window is not shown anymore. while !RM_App["WaitAliasChild"]("NewTemplate, 500).Exists Delay(500)
Caveat: If something goes wrong, this can be an infinite loop. So, I often add a counter to put a limiter on the loop to limit how many times it loops. But hopefully this should help get you in the right direction.