0

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

Rodger Nadal
  • 309
  • 2
  • 8
  • 21
  • what all methods have you tried till now - to start with, are you able to highlight it ? if so then simplest thing you can try is use wait() after "Showcontextmenu". other thing you may try is arrow keys by sendkeys method – Pranav Sep 07 '17 at 14:08
  • @Pranav I am not able to highlight it. When I do right Click, The Next line Code doesn't get executed and msgbox iis showing blank. – Rodger Nadal Sep 08 '17 at 06:56
  • now that we narrowed it down - try different object identification methods so that you can identify the 'wpfmenu'. Also why dont you use ".click ,,, micrightbtn" method ? – Pranav Sep 08 '17 at 10:55
  • Were this for a `Browser` application, I would suggest changing from Browser events to Mouse events using `Settings.WebPackage("ReplayType")` but I don't know if there's an equivalent `Wpf` setup... – Dave Sep 13 '17 at 12:35
  • @Dave No this is wpf Application – Rodger Nadal Sep 18 '17 at 11:04
  • @Roger why do you have WPF objects inside of SWF objects, I've never seen them mixed and matched like that. I am used to seeing WpfWindow().WpfTable() – dank8 Sep 22 '17 at 01:15
  • Hmmm. HP-UFT struggles with menu items... is it because of hidden text . I was able to select a menu item "Edit" but not an item "GeoTag From Map" my menu items seem to include a trailing space but even with a space did not match. – dank8 Sep 27 '17 at 01:07

1 Answers1

0

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.

dank8
  • 361
  • 4
  • 20