| || |
I am very new to TestPartner and this is my first post so go easy on me ;-)
I am automating tests for a C++ Windows application using TP 6.1. In the test that I am attempting to construct I will have closed one window that was open as part of my workbook in this application, open the same workbook back up and using the Window menu confirm that the window that was closed prior to the save does not appear in the menu. Because our main menu is not recognized as a toolbar by TestPartner I have to access it via a different approach (GUIObject("PrxCmdBar").TextSelect "Alerts") and also must use this approach when accessing the submenus that exist below the main menu items (GUIObject("PrxCmdBar").PopupMenuSelect "Crush") so using the GetMenu method does not work for determining the contents of the Window method. I have tried to use the TextExists functionality in order to determine if the window name appears but TP always responds as if it was there. The TP Help docs recommend using the InvokePopupMenu method which I tried, but I get a message which says Failed To Invoke Menu. Originally I though that this was an issue with our application but I just tried the example exactly as it is in the help text (it was designed to be used with Notepad) and it responds the same way. I would love to hear your suggestions on what other approaches I could try.
I thought maybe I should include the example from TP Help
The following code uses the InvokePopupMenu() method to highlight the menu item in the second position of Notepad's main menu. The code then looks for the menu item "Replace" under that menu, and displays a message box based on whether the "Replace" menu item is found.
Dim m As TMenu
Dim mi As TMenuItem
Dim i As Integer
i = 2
Window("Application=NOTEPAD.EXE Caption='Untitled - Notepad'").Attach
Set w = Window("Application=NOTEPAD.EXE Caption='Untitled - Notepad'")
Set m = w.GetMenu(tpMenu)
Set mi = m.GetItem(i)
If m.FindItem("Replace") Then
MsgBox "'Replace' menu item found"
MsgBox "Replace menu item NOT found"
Apparently there is a playback setting that can cause this issue, In case anyone else runs in to this, make sure the Tools-Options-Playback-Menu By Command" option is set to No