Menu
Usage notes
- Close context menus when you're done. A context menu left open is a visible top-level
window of the app. Windows can then report it as the app's main window, and
get_main_window()returns the popup instead of your form. Press Escape until no menu is left before the next step (#82). - Checkable menu items on WinForms don't support the Toggle pattern, so
toggle()/is_checkedfail there (#78). They work on WPF. - UIA3 + WinForms context menus are unreliable. Use UIA2 for them (#79).
flaui.core.automation_elements.Menu
Bases: AutomationElement
Class to interact with a menu or menubar element
is_win32_menu
property
writable
Flag to indicate if the containing menu is a Win32 menu, which needs special handling.
Mirrors C# Menu.IsWin32Menu; :attr:is_win_menu is the older alias for the same value.
Returns:
| Type | Description |
|---|---|
bool
|
True if the menu is a Win32 menu, else False |
is_win_menu
property
writable
Flag to indicate if the containing menu is a Win32 menu because that one needs special handling
Returns:
| Type | Description |
|---|---|
bool
|
True if the menu is Win32 model, else False |
items
property
Gets all MenuItem which are inside this element.
Returns:
| Type | Description |
|---|---|
List[MenuItem]
|
List of Menu Items |
get_item_by_name(name)
Gets the menu item by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the menu item |
required |
Returns:
| Type | Description |
|---|---|
MenuItem
|
MenuItem element |