1

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.:

workersJavaTree.Select("Node1;Node1.2")

the object workersJavaTree does not exist anymore.

1

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

workersJavaTree.init()

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)
    object.init()
    isInitialized = False
    If NOT(object.Exist(timeToWait)) Then
        ReportAndLogFailWithScreenshot "Initialized object was not found in " & timeToWait & " seconds", details
        isInitialized = False
    Else
        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.