Micro Focus QTP (UFT) Forums
Capture context menu item - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Capture context menu item (/Thread-Capture-context-menu-item)



Capture context menu item - fd1 - 07-11-2008

Hi All,
Using QTP, I'm trying to right click on a web link and select "Save Target As". So far I haven't been able to do right click on the link to open the context menu. I tried (.FireEvent "onclick", 1) and it only clicks on the link similar to left clicking the link.
I also tried (.FireEvent "onContextMenu", 1)and nothing happened there.
Is there a way for doing this?

Thanks


RE: Capture context menu item - blanchedsouza - 07-14-2008

QTP never records, right click events.
for that either you need to configure the xml file and import, which is a time consuming process OR simply add the syntax of right click to your code.

e.g.

Code:
Browser("abc").Page("abc").frame("xyz").Link("opq").Click 5,3,micRightBtn '(where 5, 3 are x, y co-ordinates)
Browser("abc").Page("abc").frame("xyz").webtable("ghi").FireEvent "oncontextmenu"
And then select your item from the context menu

above code will solve your problem.