wpfvbscripthp-uftuft14

Why does the variable which stores dialog box not closing application in UFT?


I recorded the sample flight application with UFT recording feature and surprisingly, the below mentioned code does everything apart from closing the application, that is x.close does not close the application.


Set x = WpfWindow("HPE MyFlight Sample Applicatio")
x.WpfEdit("agentName").Set "John"
x.WpfEdit("password").SetSecure "59533cbffdbec3d9d0ff"
x.WpfButton("OK").Click
x.Close

Solution

  • Before Closing the wpfWindow, set the object reference again as shown below.

    After OK button is clicked, the window has "refreshed"(should I say?) and you are still using the existing reference to that window.

    Set x = WpfWindow("HPE MyFlight Sample Applicatio")
    x.WpfEdit("agentName").Set "John"
    x.WpfEdit("password").SetSecure "59533cbffdbec3d9d0ff"
    x.WpfButton("OK").Click
    Set x = WpfWindow("HPE MyFlight Sample Applicatio")    'Added this line just after clicking on OK button but before closing the wpfWindow
    x.Close