WaitProperty throwing error
Hello everyone,
I have a below code that returns the 'requiredobject' if it exists and if it does not exist on the desktop. I have some assertion units that need this object for further testing. I have used 'requiredobject.WaitProperty('Exists', true, waitLongTime); ' as sometimes the object cannot be found immediately and takes time to appear. Now the problems is that when the object doesn't exist in the first If check and the 'else if' is executed, the 'requiredobject.WaitProperty' logs that 'object doesn't exist' in the test log (I run my script on 'Continue on Error' so I only get results after complete test execution) before waiting for the 'Exists' property. I don't want this error in the logs. I can also use Delay method, but apparently, WaitProperty is most preferred in the test complete documentation?
if (requiredobject.Exists && requiredobject.VisibleOnScreen == true) {
return requiredobject;
} else if (!requiredobject.Exists) {
requiredobject.WaitProperty('Exists', true, waitLongTime);
if (requiredobject.Exists && requiredobject.VisibleOnScreen == true) {
return requiredobject;
} else {
return requiredobject;
}
}
}
Thanks,