Skip to content

Infragistics Community Forum / Test Automation For Micro Focus Uft Windows Forms / Select Item from Context Menu in Infragistics Tests

Select Item from Context Menu in Infragistics Tests

New Discussion
Vidyasri
Vidyasri asked on Jul 17, 2009 10:36 PM

I have a right clicked context menu. QTP is able to record following steps:

Step 1: SwfWindow(“Workspace 01 – ProfitTaker”).SwfObject(“indicatorExplorerBar”).SelectItem “Basic”,”Predicted Low”
Step 2: SwfWindow(“Workspace 01 – ProfitTaker”).SwfObject(“indicatorExplorerBar”).ItemContextMenu “Basic”,”Predicted Low”

Step 1 makes QTP to select an item in the indicator panel. Step 2 makes it to right click on that particular item. after this step, I will see a contextMenuStip that has three items it it – Remove, Delete and Properties. I have to click on this Properties to see Properties window of “Predicted Low”. but QTP is not recording this click and is not selecting Properties. Clicking on this Properties is very much required to continue my test. When I recorded very first time, QTP recorded this step as:

SwfWindow(“Workspace 01 – ProfitTaker”).SwfToolbar(“contextMenuStrip1”).Select “Properties…”

but second time it has not even recording this line. I executed above step but to my surprise, it is not able to run the same step that it has recorded. I am surprised why QTP is able to record this for the first time and why not for the next subsequent recording.

Sign In to post a reply

Replies

  • 0
    Dennis
    Dennis answered on Jul 17, 2009 10:36 PM

    I'm not sure if this is the same situation as you're dealing with, but we've had instances when we had to do some descriptive programming to get QTP to interact with the controls the way we wanted.

    For example, when we wanted to right-click on an ultragrid and select an option from the Context Menu, we had to use the SendKeys method so that QTP would "press" the Down Arrow key the desired number of times to select the option we wanted. Here's an example:

    Dim WshShell
    SwfWindow("Company").SwfWindow("Report").SwfTable("ultraGrid1").RightClick "2","0;ItemSize"
    set WshShell = CreateObject("WScript.Shell")
    WshShell.SendKeys "{DOWN}"
    WshShell.SendKeys "{DOWN}"
    WshShell.SendKeys "{DOWN}"
    WshShell.SendKeys "{ENTER}"
    SwfWindow("Item Summary").SwfWindow("SwfWindow").SwfToolbar("SwfToolbar").Select "Restore Default Layout"

    We're using TestAdvantage 2006 Volume 2 CLR 1.x and were eventually able to install a Hotfix from Infragistics that allowed us to perform the right-click without using the SendKeys method:SwfWindow("Item Summary").SwfTable("ultraGrid1").RightClick "2","0;ItemSize"
    Wait 1
    SwfWindow("Item Summary").SwfWindow("SwfWindow").SwfToolbar("SwfToolbar").Select "Restore Default Layout"

     

    We never had an instance when we needed to select a level beyond the first level of the Context Menu, but we did find that it was necessary at times to add a Wait statement between the "Right-Click" and the "Select" to give the Context Menu time to expand and make the desired selection.

    I hope this helps in some way. Let me know if you need further explaination.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Vidyasri
Favorites
0
Replies
1
Created On
Jul 17, 2009
Last Post
16 years, 7 months ago

Suggested Discussions

Tags

No tags

Created by

Created on

Jul 17, 2009 10:36 PM

Last activity on

Feb 11, 2026 12:44 PM