TC 12.3, WinFormsObject(name).Exists raises run-time error instead of false
Anyone else come across this?
I don't know if this happens all the time, but in our automation tool that leverages TC for screen interactions, WinFormsObject(name).Exists now raises a run-time error -2072187182 with message:
Unable to find the object WinFormsObject("myTestObjectName"). See additional Information for Details. The object with the specified attributes does not exists. Possible causes of the error: aqa-help://2202
This was not a problem in earlier versions (11.2 and before). The .Exists would simply return a false value and would allow my automation to proceed according to the specified logic.
I have over 250 instances of this, rewriting all the code to trap this correctly is not a pleasant prospect.
The WaitWinFormsObject(""myTestObjectName", 100).Exists seems to work as expected.
When I first started using TestComplete back in 2001-2002, the behavior was as it is now... a "Wait" method needed to be used for object detection because, otherwise, it would return the runtime error you described. Understandably, that may have changed, but logically, it makes sense as mentioned above:
1) Can't check the "Exists" property of something that is NULL
2) The method is being executed to look for an object that doesn't exist so returns the runtime error.
Now, potentially, SmartBear could correct #2 above. I think I remember a discussion something to that end in the past but I don't recall the result. In any case, as mentioned, it's always a best practice to "Wait" if you're going to check existence... cleaner code all around.