Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can not select an item from a context menu
#1
Solved: 10 Years, 8 Months, 4 Weeks ago
Hi all,

Does someone knows how I can select an element from a context menu?

I use this script:
'After a right click on the element "jive-doc-copy-link", a conext menu is opened and I want to select the item "Copy" from it.

Code:
replaytype = Setting.WebPackage("ReplayType")
Setting.WebPackage("ReplayType") = 2
Root.Frame("Frame").WebEdit("jive-doc-copy-link").Click ,, micRightBtn
Setting.WebPackage("ReplayType") = replaytype


I can not add it in the OR manually and I do not know how I can do it descriptively, because I do not know any of its properties.

Is someone familiar with this?

Thank you in advance and best regards.
Reply
#2
Solved: 10 Years, 8 Months, 4 Weeks ago
First, Please unbold the charachters. Bold only those you want to highlight.
Context menu's cannot be added to the OR because the object properties are lost as soon as the menu dissapears and no context menu stays there.

There are 2 ways of doing it,

1. Record the action you want to do ?? Have you tried this yet ? IF the application supports it will record the object in the Local Repository. Once the recording is done export it to the shared OR.

2. While adding the object from the OR, the moment you click on the pointing hand, hold the ctrl key and perform the action on the application until the context menu appears. Release the ctrl key and click on it. 50% chances are that the object will get captured with some properties. But that is a total risk.

I suggest try the first one. If it does not work, try the second one. If both do not work, post your findings back and we will work through a solution.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Solved: 10 Years, 8 Months, 4 Weeks ago
Hi basanth27,

Thank you first for the answer and sorry for the bold characters.

I have tried of course, first to record this (including the right click on the element), but it did not work.

Then I configured the xml file for Web Event Recording Configuration in QTP, but again it did not work.

Now, with the code above I was able to perform the right click, but nothing more.
I can not select an item from the context menu.

I tried the solutions that you suggest, but they do not work for me.
With pressing CTRL key, the context menu was identified as a Window (with no properties) and it seems that I can not use the method Select for the object Window.

What can you advise me Smile

Regards.
Reply
#4
Solved: 10 Years, 8 Months, 4 Weeks ago
Search this forum for DeviceReplay. I am sure it will help you.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#5
Solved: 10 Years, 8 Months, 4 Weeks ago
Once you highlight an element you can use Send Keys.
For right click use "+{F10}" In case the menu offers a shortcut use that, else use {DOWN n} where 'n' is the position of 'Copy' element.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#6
Solved: 10 Years, 8 Months, 4 Weeks ago
QTP does not like (does not support) context menu also right click as well and so you will not be able to do anything directly with this. But definitely we can do this by other ways. I can suggest one of the way could be -
Note the position of your required item (2,3..)
do Right click using device replay or your preffered way.
traverse thru menu using sendkeys up or down
select the option using sendkeys Enter.

Try this, see if it helps you

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to select item within WebMenu learnasugo 4 7,708 10-11-2016, 03:35 PM
Last Post: learnasugo
  QTP captures MFCMenubutton as winobject.Help Me to select menu's inside MFCMenubutton surestud 1 2,737 04-10-2015, 02:17 PM
Last Post: Naresh
  ContextMenu item disabled Powerbuilder Phread 1 3,897 05-24-2012, 10:15 AM
Last Post: Shridevi.Salagare
  Unable to select an item from weblist and unable to enter text in edit box estherindu 5 9,146 05-15-2012, 12:07 AM
Last Post: viswa
Rolleyes How to select multiple choices from Multi-Select weblist blavanya 3 9,525 01-03-2012, 05:55 PM
Last Post: shivu.hanu

Forum Jump:


Users browsing this thread: 1 Guest(s)