Forum Discussion
The ~10 seconds comes from the project settings,
In Waiting for an Object, Process or Window Activation, use WaitNNN methods.
If you are checking the property value of an object, then the object must exist.
I don't need to wait for the property to exist after deletion; my goal is to assert that it doesn't exist anymore. How can I achieve this without adjusting the auto-wait timeout, but instead using a method tailored for this particular situation?
- rraghvani7 months agoChampion Level 3
WaitNNN methods are used to wait for an object in test, which is different from property. You can specify a timeout period of 0 seconds, and it will return the needed object if it exists. Otherwise it will return a stub. To check whether the returned object is a valid object, use the Exists property.
I suggest you try the examples given in the link that I have provided, on the control you are working on.
- AlexKaras7 months agoChampion Level 3
Hi,
> if(!Aliases.restOftheCode.exists)
> I don't need to wait for the property to exist after deletion
Can you provide more details about your exact actions, how these actions change tested objects hierarchy and what is inside "restOftheCode" portion? And what is logged to the test log? Does it contain any error related to this portion of code?
It is my wild guess that "restOftheCode" contains something like "obj1.obj2.obj3". It is also my guess that either obj3 or even obj2 and obj3 are removed from the application's object tree after deletion.
If both my guesses are right, then your "Aliases.obj1.obj2.obj3.Exists" line of code effectively tells this to TestComplete: "Look for aliased obj1 object, then look for aliased obj2 child, then continue and look for aliased obj3 child object and for found obj3 object check the value of its .Exists property".
Note, that the above assumes that obj1, obj2 and obj3 exist (possible caching might also matter: https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/refreshmappinginfo-method.html). If any of them does not exist, this will cause TestComplete to wait for the absent object to appear (with default 10sec timeout).
What I would try to speed-up the check is to store the initial reference to the object to some variable and working with this variable than. E.g. (assuming obj3 is going to be deleted):
var objToBeDeleted = Aliases.obj1.obj2.obj3;
if (objToBeDeleted.Exists) {
// perform deletion
// optionally, wait enough for the object to be deleted or use WaitProperty() method to wait for .Exists property to become false
if (!objToBeDeleted.Exists)
// report successful deletion
else
// report that object was not deleted within given timeout
}
else
// report object absence
Hope this will help.
Related Content
Recent Discussions
- 6 days ago
- 6 days ago
- 10 days ago