Application object is not defined after closing and opening again. There are no runtime errors but all actions performed under object in application can not force it to act, e.g.:


the object workersJavaTree does not exist anymore.


After reopening the object in application UFT object should be reinitialized:


And then all actions under the object are performed well.

Hierarchical structure while initializing

If there are several objects that are reloaded/reopened (e.g. reload a form with several fields & controls) you should init() the top-most one. And all children after that are available. Chech the next picture:

enter image description here

You should only do object_3.init(), after that you can start with object_5.doSomething().

Timer after initialization

Sometimes object is not seen right after the initialization, so I have created custom init() function with check that object already exists:

' customized initialization of reloaded/reopened object
Function customizedInit(object, timeToWait, details)
    isInitialized = False
    If NOT(object.Exist(timeToWait)) Then
        ReportAndLogFailWithScreenshot "Initialized object was not found in " & timeToWait & " seconds", details
        isInitialized = False
        isInitialized = True
    End If

    customizedInit = isInitialized
End Function

Attention: in this function you should use the object that would be used in action not the top-most.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.