Not able to select WpfMenu Button inside WpfTable

372 views Asked by At

I need to perform Right Click in the Middle of WpfTable, then WpfMenu appears and I want to select a particular Option from it. See the Screenshot for more details:-

enter image description here

Here is Code I am trying:-

Function IncidentCancellAllActions()
    Dim Rowcnt
    Rowcnt = SwfWindow("VisionCommandClient").SwfObject("VisionCC_Incident_ActionsTab_SWO").WpfWindow("VisionCC_Incident_ActionsTab_WpfWin").WpfTable("VisionCC_Incident_ActionsTab_WpfTable").RowCount
    If Rowcnt > 0 Then
        SwfWindow("VisionCommandClient").SwfObject("VisionCC_Incident_ActionsTab_SWO").WpfWindow("VisionCC_Incident_ActionsTab_WpfWin").WpfTable("VisionCC_Incident_ActionsTab_WpfTable").ActivateCell
        SendFromKeyboard("1-SHFT-F10")
        wait 5
        'SwfWindow("VisionCommandClient").WpfWindow("VisionCC_ResourceStatusList_WpfWin_2").WpfMenu("VisionCC_Action_WPM").Select "Cancel All"
        msgbox SwfWindow("VisionCommandClient").WpfWindow("VisionCC_ResourceStatusList_WpfWin_2").WpfMenu("VisionCC_Action_WPM").ShowContextMenu
        SwfWindow("VisionCommandClient").WpfWindow("VisionCC_ResourceStatusList_WpfWin_2").WpfMenu("VisionCC_Action_WPM").Select "Cancel All"
        wait 2
    Else
    Exit Function
    End If  
End Function

After right Click, It is not clicking on WpfMenu option "Cancell All".

1

There are 1 answers

0
dank8 On

Had this problem and currently working around the problem using '.Type' method:

WpfWindow("MyWindow").WpfButton("Item-Menu").ShowContextMenu
WpfWindow("MyWindow").WpfMenu("List-Menu").Exist(1)
menuItems = WpfWindow("MyWindow").WpfMenu("List-Menu").GetVisibleText
menuItems = replace(menuItems, chr(13),"")
for each menuItem in split(menuItems,chr(10))
    WpfWindow("SAP Work Manager").WpfMenu("List-Menu").Type micDwn
    Wait 0,400 
    If instr(1, menuItem, "MenuItemToClick") > 0 Then 'replace MenuItemToClick with the menu item text.
        Exit for
    End If
next
WpfWindow("SAP Work Manager").WpfMenu("List-Menu").Type micReturn 

This works as long as the order of menu items doesn't change. Waits are included because ive noticed HP-UFT doesn't check that the object is fully loaded before doing the next task.