Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinForms MenuStrip's ToolStripMenuItem children are not accessible #185

Closed
JonHeaton opened this issue May 4, 2017 · 5 comments
Closed
Assignees

Comments

@JonHeaton
Copy link

I am trying to automate a menu in my application and the MenuBar comes in but not the MenuItems that are inside of it.

Here is the menubar from the page source on the driver:

<MenuBar AcceleratorKey="" AccessKey="" AutomationId="menuStrip1" ClassName="WindowsForms10.Window.8.app.0.141b42a_r9_ad1" FrameworkId="WinForm" HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="menu bar" Name="menuStrip1" Orientation="None" ProcessId="16340" RuntimeId="42.5048014" x="60" y="83" width="284" height="24" />

I know that the MenuStrip does not implement UIAutomation and are only exposed to UIAutomation via MSAA. MSDN Supported Controls for UIAutomation

The Inspect tool does show the menu items whether I am in UIAutomation mode or MSAA mode.

The only inkling that it could be something in my setup is that when I catch ALL exceptions, there is a COMException in Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll
Retrieving the COM class factory for component with CLSID {177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Is this supposed to work? I have a small sample project that illustrates the issue if needed.

Thanks,
Jon

@KanstantsinSudzilouski
Copy link

I saw people in #83 also complains that WinForms does not work properly. We have to reject WinAppDriver and Winium and start with White instead to test WinForms application.

@yodurr
Copy link
Contributor

yodurr commented Jul 10, 2017

At the moment WinAppDriver does not support MSAA. Is this control provided by a 3rd party? Would be good to find out if they are open to updating the control to support UI Automation.

@PandaMagnus
Copy link

Are there plans to support MSAA at some point? The MSDN documentation I've found makes it pretty clear they have no plans to continue to develop it, which is understandable. But when looking for solutions to test legacy apps, we've been pretty pigeonholed into writing our own CodedUI tests... which while slightly more manageable than using record and playback is still not an ideal solution.

@hassanuz hassanuz self-assigned this Dec 9, 2017
@hassanuz
Copy link
Contributor

hassanuz commented Dec 9, 2017

Hi @JonHeaton ,

There was an issue prior to the 1.0 release where a few elements were not appearing. Controls that are properly implemented in MSAA are projected into UIA, they should be generally interactable.

If you still see this on the latest WinAppDriver, let us know.

@edw-c
Copy link

edw-c commented Dec 20, 2018

I'm using WinAppDriver v1.1.1809.18001 and am having problem seeing items within a MenuStrip dropdown menu. I'm testing with a new C# WinForms application in VS2015, adding a MDIForm and editing program.cs to open the MDI form on startup.

Using WinAppDriver I can see and click the menus along the menu bar (File / Edit / Help) , but I can't select or click items within the dropped down menus.

Using inspect.exe in MSAA mode and navigating the MDIForm with the mouse, I can see items within the menu (e.g. Help / About).

Using inspect.exe in UI Automation mode and navigating the MDIForm with the mouse, I can't see items within the menu. Navigating with the keyboard, the Focus event gets the Name of the menu item in the tooltip, but it is not shown in the main inspect.exe application pane.

Now I can work around this like this:

     // Click Help
     session.FindElementByName("Help").Click();
     // Use keyboard to select About item.
     session.Keyboard.SendKeys("a");

But I'd prefer to select and click the About item more explicitly. Can you advise if there's anything that can be done to help this control project into UIAutomation properly? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants