How to click a submenu in Coded UI?
-
Monday, September 10, 2012 3:56 AM
Hi,
I need to click a Rules sub menu ( Tools->Setup->Rules) in my application. Can you please tell me on how to do this?
Thanks in Advance...
Thanks
Selvaraj C
All Replies
-
Monday, September 10, 2012 6:54 PM
If you are are Handcoding, then you can do 1 o the following:-
1. If you need to click to launch submenu then individually click and expand then click on next item. The action would probably get aggregated if the controls are not custo controls.
2. If you need to hover, you can record an explicit hover using the keys "Ctrl + Shift + r" while the mouse is on the control.
If you are recording using coded ui, then 1 of the above 2 should work. If the controls arent custom controls you should be able to record an aggregated action which would get played back.
Which technology are you trying to record on? Is the menu being recognized as a Menu and a MenuItem?
- Proposed As Answer by Srishti [MSFT]Microsoft Employee Monday, September 10, 2012 6:54 PM
-
Tuesday, September 11, 2012 6:57 AM
Hi,
I tried the above steps but it doesn't works for me. I am using Coded UI Test builder to record the actions. While trying to click on the sub menu, the generated code is as follows:
// Click 'MainMenuBar' client
Mouse.Click(uIMainMenuBarClient, new Point(102, 10));
// Click 'Desktop' client
Mouse.Click(uIDesktopClient, new Point(55, 32));
// Click 'Desktop' client
Mouse.Click(uIDesktopClient, new Point(92, 165));and below is the screenshot of my sub menu
Please share your thoughts on this
Thanks
Selvaraj C
-
Tuesday, September 11, 2012 11:16 AM
does the main menu open when you click on it? if yes,can you try adding Wait between mouse.click()
Regards,
Chetan
-
Wednesday, September 12, 2012 4:53 AM
Hi SelvaRaj,
Try using the below ways :
//Click on Rules HtmlHyperlink c_Link = new HtmlHyperlink(browser); c_Link.SearchProperties.Add("InnerText", "Rules", PropertyExpressionOperator.Contains); Mouse.Click(c_Link);I hope it will work,as some times the control is hidden,but you can click on that control witout clicking on MainMenu link
Please let me know incase if it does not works
Thanks and Regards -Rajendra
-
Wednesday, September 12, 2012 6:30 AM
Hi,
My Application is a Windows based application. So I think that HtmlHyperlink is belongs to Web based Application. Am I right?
So, can you please tell me on how to achieve the same for the Windows based application.
Thanks
Selvaraj C
-
Wednesday, September 12, 2012 9:22 AMReplace HtmlhyperLink with WinHyperLink, if it does n't work then, Spy the menu item with CodedUITest builder and check that which control it is, accordingly you have to define your control
Thanks and Regards -Rajendra
- Edited by RajendraC Wednesday, September 12, 2012 9:23 AM
-
Thursday, September 13, 2012 7:27 AM
HI,
I tried with WinHyperLink but it doesn't work. Also when I am trying to spy the submenu, the menu get closed while spy the menu using Coded UI test builder. Please help me in this case. Also please tell me on how to use Win+I feature in Coded UI Test builder step by step
Thanks
Selvaraj C
-
Friday, September 14, 2012 3:17 AMModerator
Hi Selvaraj,
If you install VS2010 FP2, double click the UIMap.uitest, could you see the Rule control in the UI Control Map? Maybe you could share us a screen shot about it.
If you need to click to launch submenu then individually click and expand then click on next item. The action would probably get aggregated if the controls are not custo controls.
I agree with Srishti’s suggestion, if it is not the custom control, it would work well when we try to record the action with the Coded UI Test Builder.
If possible, you could share us a simple sample with sky driver, we try to record a coded UI test for this app.
Best Regards,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
- Edited by Jack Zhai - MSFTMicrosoft Contingent Staff, Moderator Friday, September 14, 2012 3:17 AM
-
Monday, September 17, 2012 6:53 AM
Hi,
PFA the UI Visual Editor Screenshot. Sorry I am not able to upload the sample application in the Sky driver as we don't have any samples.
Please share your thoughts on this.
Thanks
Selvaraj C
-
Monday, September 17, 2012 9:31 AM
You can use the Spy ++ or the UI Spy tools that come along with VS and VS SDK. You will be able to get the control information from them ,and can probably do hand coding for it- Marked As Answer by Jack Zhai - MSFTMicrosoft Contingent Staff, Moderator Tuesday, October 02, 2012 1:51 AM

