This project is read-only.

Clicking a menu item

Aug 5, 2011 at 7:57 AM

How do I click on a submenu using CUITe? I have a menu like Menu >> Submenu1 >> Submenu1,1 and Menu >> Submenu2 >> Submenu2.1. I want to be able to click on the on the submenu. I can click on the Main Menu but when I try to click on the submenu I get the "can not click on the hidden control" error.

Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException: Cannot perform 'Click' on the hidden control. Additional Details:
TechnologyName:  'Web'
ControlType:  'Cell'
Id:  ''
Name:  ''
TagName:  'TD'
MaxDepth:  '3'
 ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0xF004F002

Aug 5, 2011 at 8:19 AM

Have you tried to add "Playback.Wait(2000);" for example in between menu clicks to give the submenu item time to appear?

You can also try to specify a different configuration setting on Playback.PlaybackSettings for example.

Your question does not seem to be directly related to CUITe and so your question may be better asked in the "Visual Studio UI Automation Testing (includes CodedUI)" developer forum here:


Aug 8, 2011 at 12:58 PM

I assume the menu you are talking about is a JavaScript menu which is rendered on the fly at run time. These kind of UI widgets are tough to automate.

However, with a little bit of Javascript knowledge you can get it working with CUITe.

See '6. How much value does JavaScript support give to web automation? Can you give some examples?' in [Frequently Asked Questions].

I see that you recorded each menu/menu-item/sub menu-item as a separate object. Then you are trying to click on each menu, menu-item and sub-menu-item. The problem you are facing is most probably due to the sub menu item taking time to become visible. As icnocop suggested, giving some wait time may fix the issue.

A neater approach would be to consider the entire menu as a control and use the object hierarchy to navigate to what ever level and interact with it. It is not straight forward, but neat, maintainable and professional.

If you could point me to a similar menu, I can give some more tips on it, if needed.

Oct 25, 2011 at 2:11 PM



I am also facing issue with Menu(this is sharepoint control)


<DIV class="ms"-MenuUIULItem menuGroupId="200" description="Logout of this site." text="Sign Out" onMenuClick="STSNavigate2(event,'/_layouts/SignOut.aspx');" type="option" enabled="true" onMenuClick_Original="STSNavigate2(event,'/_layouts/SignOut.aspx');" text_Original="Sign Out" description_Original="Logout of this site.">
<A id=mp1_0_6_Anchor class="ms"-MenuUIULLink onclick="return false;" href="javascript:;">
<SPAN style="WHITE-SPACE: nowrap" class="ms"-MenuUIIconLarge align="center">
<IMG id=mp1_0_6_ICON class="ms"-MenuUIULImg title="" alt="" src="/_layouts/images/blank.gif" width=32 height=32></SPAN>
<SPAN id=zz4_ID_Logout class="ms"-MenuUILabel><SPAN style="WHITE-SPACE: normal">Sign Out</SPAN>
<SPAN style="WHITE-SPACE: normal" class="ms"-menuitemdescription>Logout of this site.</SPAN><SPAN></SPAN></SPAN><SPAN style="WIDTH: auto; DISPLAY: none; WHITE-SPACE: nowrap; cssFloat: left" class="ms"-MenuUIAccessKey></SPAN><SPAN style="DISPLAY: none; WHITE-SPACE: nowrap" class="ms"-MenuUISubmenuArrow></SPAN></A>

Here i wan to click on sign out.

Getting error cannot perform click on hidden controls