Skip to main content

How to Read or Select Context Menu or Right Click Menu using QTP.



Select The Item in Right Click Menu or Context Menu: Window("sampleWindow").WinMenu("MenuObjType:=1).Select"File;New"


Here MenuObjtype can be 1 r 2 r 3 .......n

Check wether the Item is Exist or Not:
If Window("sampleWindow").WinMenu("MenuObjType:=1).GetItemProperty("1","Exist") Then
  Msgbox"Exist"
Else
 Msgbox"Does Not Exist"
End If
 
                                      Or

If Window("sampleWindow").WinMenu("MenuObjType:=1).GetItemProperty("File","Exist") Then
  Msgbox"Exist"
Else
 Msgbox"Does Not Exist"
End If


Get the Items in Context Menu:
For i = 1 to 10
Print  Window("sampleWindow").WinMenu("MenuObjType:=" & i).GetItemProperty("1","Label") Then
Next

Comments