Hi,
I'm trying to automate the selection of an element from a drop down menu in an app. The problem is, I'm unable to access the menu in the first place. It does not show up when I hover over it in with Inspect.exe.
If I click open the menu and focus on one of the menu items, then I'm able to see the menu item in Inspect.exe. Its type is an UIA_ListItemControlTypeId and its ClassName is "ListBoxItem". I can trace back through this item's ancestors to the Desktop, which look like this beginning from the immediate parent:
>> "Menu Item" group (ControlType: UIA_GroupControlTypeId, ClassName: GroupItem)
>> "" pane (ControlType: UIA_PaneControlTypeId, ClassName: ScrollViewer, AutomationId: DropDownScrollViewer)
>> "" window (ControlType: UIA_WindowControlTypeId, ClassName: Popup)
>>"MyApp- Microsoft Visual Studio" window (ControlType: UIA_WindowControlTypeId, ClassName: Window).
>> "Desktop 1" pane
The problem here is that the window element with ClassName "Popup" only sees the main app ("MyApp- Microsoft Visual Studio") as a parent if it has been clicked open and left open--otherwise, Inspect.exe says it has no ancestors if the Popup menu hasn't been clicked opened. Similarly, The window Popup is not shown as a child of the main app.
So my main question is--how can I programatically expand this menu (and access its menu items), which doesn't appear in Inspect.exe until it has been clicked? I wonder if it is possible without sending an input mouse click through the Windows API and accessible directly through the Microsoft UI Automation framework, since I would like to make the automation as close-looped as possible.