Mouse right click for context menu
The below code right clicks on a link in a page named “Document” and selects “CreateDocument” in the context menu. Each option in the menu belongs to WebElement class.
'set the path to an object
Set pathObj = Browser(“objBrowserName”).Page(“objPageName”)
'Create an object of DeviceReplay class which helps us simulate mouse click operation
Set deviceReplay = CreateObject(“Mercury.DeviceReplay”)
'Get the X-axis value of the link
getX = pathObj.Link(“Document”).GetROProperty(“abs_x”)
'Get the Y-axis value of the link
getY = pathObj.Link(“Document”).GetROProperty(“abs_y”)
'Simulates the right click operation over the link
deviceReplay.MouseClick getX,getY,RIGHT_MOUSE_BUTTON
'Click on the “CreateDocument” option.
pathObj.WebElement(“name:=CreateDocument”).Click
Set deviceReplay = Nothing