Using Exists method in a if statement
Hello,
I have a if statement that checkes whether an object exists, if the object_A exists then set it as a wrapper, if object_A doesn't exist, then Object_B will exist for sure, so then set object_B as the wrapper. But when object_A doesn't exist, TC keeps waiting, until the default wait time runs out. Is that how it works? Is there any method I can use to check and switch to object_B if A is not found without waiting? Both object_A and B are mapped.
If Object_A.Exists Then
set wrapper = Object_A
Else
set wrapper = Object_B
End If
I also tried namemapped the parent of the object that I want to check, then I do If Object_Parent.WaitAliasChild("Target_Object",0) Then xxxx, but it returns the parent object doesn't have a child with the target object name.
Thanks
whuang wrote:
Is there any method I can use to check and switch to object_B if A is not found without waiting?
No, but you can limit the wait time by using a WaitNNN with a very short timeout e.g
Object_A = Object_A_Parent.WaitAliasChild("Object_A",100);
This of course assumes that Object_A_Parent exists...