Forum Discussion
If you are using Vb script you can use On Error Resume next or in Jscript you can use try catch block.
- tristaanogre6 years agoEsteemed Contributor
As mentioned, exception handling is not going to work on this. Instead, what you're going to have to do is make your code "smarter". For those points where object recognition is failing or similar things, you'll need to add logic to break out of the loop on those errors. In pseudo-code:
if (!Aliases.myApp.parentObject.WaitAliasChild("childObject", 5000).Exists) then
End Loop
This is actually a recommended best practice for any situation where you aren't sure that the object is going to apear in time and that object existence is part of the test.
- fm286 years agoNew Contributor
Thanks for the answer.
I succeeded to pu it in place, but I'm obligated to put it on every line (about 40/50 lines). childObject isn't generic; there is no generic solution ? without specifying a childobjet ?
The error can be everywhere, jsute because of a slow response or it was too fast.
- tristaanogre6 years agoEsteemed Contributor
As mentioned, this way of writing tests is best practice: check for existance before using the object if there is doubt. So, making the change all around is necessary re-factoring.
There's no "generic" child object because you need to specify what object you're waiting for to exist... you can't just say "wait for an object"... which object?
Related Content
- 7 years ago
- 5 years ago
Recent Discussions
- 16 hours ago
- 17 hours ago
- 23 hours ago