Forum Discussion

gid_216's avatar
gid_216
Frequent Contributor
13 years ago

Object Not Exist Error

Hi,



While checking whether an object exists or not to proceed further, if the object doesn't exist, then TC automatically insert an error to log making the overall test fail even the test passed. For E.g.

If Not <ObjectToFind>.Exists Then

Log.Message "Passed"

Else

Log.Error "Failed"



here if the object doesn't exist, then script should pass as "Not <ObjectToFind>.Exists" will be True.



But here, the log coming is



Error: The object does not exist. See Additional Information for details.

Message: Passed

and makes the overall script fail. Please give me some solution to overcome such issue.





Thanks,

Deepak

1 Reply

  • sastowe's avatar
    sastowe
    Super Contributor
    If

    <ObjectToFind>

    is null vs a stub object, there is no exists property to return. Instead try



    set obj = WaitNNN("ObjectToFind", <timeout")

    If obj,Exixts then

    ....



    All of the Wait methods return a stub with the correct values for Exists.