Unable to automate use of the "More" menu of Horizontal NavigationView
See original GitHub issueDescribe the bug
When using a NavigationView
in horizontal mode and with enough items included that the “More” menu option is displayed, it is not possible to use automation tools to interact with the contents of the menu displayed when clicking the “More” button.
Is automated interaction with the menu supported? If not supported, is there a reason? If it is supported, how has it been tested?
Context I’m using automated tests (powered by WinAppDriver) to walk the entire navigation structure of an app to test that everything is as expected and there are no obvious errors. As the apps in question now include enough options to necessitate the “More” option/menu, it’s no longer possible to test the apps fully.
I can query how many items are in the pop-up, but querying details (such as the text) or trying to click on an item fails. The pop-up seems to be being created in the same way as the menu items in a MenuBar and I can query and interact with menubar items without issue. I’m assuming there is a non-obvious difference in the way the pop-up is created or there’s something special about the way that NavigationViewItems are displayed in the pop-up.
Steps to reproduce the bug
Steps to reproduce the behavior:
- Add a NavigationView with
PaneDisplayMode="Top"
- Add enough items that the “More” menu will be displayed.
- Use automation tools to open the menu and query the contents of the list. Example code below.
var moreBtn = appSession.FindElementByName("More");
moreBtn.Click();
var popupMenu = appSession.FindElementByName("Pop-up");
var moreMenuItemsCount = popupMenu.FindElementsByClassName("Microsoft.UI.Xaml.Controls.NavigationViewItem").Count;
moreBtn.Click(); // Close menu so get in a consistent state
for (int i = 0; i < moreMenuItemsCount; i++)
{
moreBtn.Click();
// Find the pop-up again as it's recreated after opening the menu each time
popupMenu = appSession.FindElementByName("Pop-up");
var moreMenuItems = popupMenu.FindElementsByClassName("Microsoft.UI.Xaml.Controls.NavigationViewItem");
// BOTH/EITHER OF THE FOLLOWING FAIL!
var entryText = moreMenuItems[i].Text;
moreMenuItems[i].Click();
.... // other code omitted
}
Expected behavior
It should be possible to query the contents of the pop-up menu in the same way as any other content. (This could be any content on the main window or in other pop-ups line menu flyouts.)
Screenshots
This menu:
Version Info
NuGet package version:
[Microsoft.UI.Xaml 2.4.2]
Windows 10 version | Saw the problem? |
---|---|
Insider Build (19621) | Yes |
May 2020 Update (19041) | |
November 2019 Update (18363) | |
May 2019 Update (18362) | |
October 2018 Update (17763) | |
April 2018 Update (17134) | |
Fall Creators Update (16299) | |
Creators Update (15063) |
Device form factor | Saw the problem? |
---|---|
Desktop | Yes |
Xbox | |
Surface Hub | |
IoT |
Additional context
Related issue also raised on the WinAppDriver repository: https://github.com/microsoft/WinAppDriver/issues/1204
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (7 by maintainers)
Top GitHub Comments
I think that this is effecting Narrator navigation within this popup as well
accessibility issues shouldn’t be closed without good reason