Forum Discussion

p6s's avatar
p6s
New Contributor
7 years ago
Solved

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 er...
  • tristaanogre's avatar
    7 years ago

    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.