Open edw-c opened 5 years ago
Hi @edw-c,
We don't know of any way to modify ToolStripMenuItem to support UIAutomation properly - though there have been discussions on this topic before.
@edw-c did you find a good way to click the menuitem explicitly?
@tu-mcleish - Unfortunately not.
@edw-c
I am seeing the same issue. I am clicking on Help and trying to get to About in the app. When I try using the keyboard shortcut to select the About menu nothing happens though. Any thoughts??
public void ClickMenuItem(string menuItem) { session.FindElementByName(menuItem).Click(); }
[TestMethod] public void VerifyMenuBar() { ClickMenuItem("File"); ClickMenuItem("Reports"); ClickMenuItem("Maintenance"); ClickMenuItem("Customize"); ClickMenuItem("Utilities"); ClickMenuItem("Help"); //Open About session.Keyboard.SendKeys("b");
}
I've recently come across this same issue - the WinForms menu bar buttons (File, Edit, Help, etc) can be found easily, and the menus that open from those buttons can have an AccessibilityName property defined and found using a desktop driver. However, in the PageSource, those menus have no child items for the individual menu buttons; the menu is a black box control.
Here's where it gets interesting. Using the inspect.exe tool, set to Watch Cursor, I get the same issue as found in the PageSource: menu (which appears as a separate window in the UI hierarchy), but no individual items. However, if you set inspect to use Watch Focus, you can mouse over individual menu items and find them perfectly (and the menu and entries are both part of the application hierarchy).
Why, if that information is available, does it not appear in the PageSource that WinAppDriver builds? And what's the difference in the Watch Focus and Watch Cursor functionalities in inspect.exe that allows the former to find what we're looking for?
I'm using WinAppDriver v1.1.1809.18001 and am having problem seeing items within a MenuStrip dropdown menu in a WinForms app. I can reproduce the issue by making 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:
But I'd prefer to select and click the About item more explicitly.
This comment in issue 185: https://github.com/Microsoft/WinAppDriver/issues/185#issuecomment-350407651 suggests that properly implemented MSAA controls will project into UIAutomation. Is there anything that can be done to help the ToolStripMenuItem control project into UIAutomation properly? Thanks