Automation Element
flaui.core.automation_elements.AutomationElement
Bases: ElementBase
UI element which can be used in automation
automation
property
The current used automation object as a Python AutomationBase facade.
Returns:
| Type | Description |
|---|---|
AutomationBase
|
Python UIA2Automation or UIA3Automation wrapper |
item_status
property
The item status of this element.
Returns:
| Type | Description |
|---|---|
str
|
Item status value |
as_button()
Converts the element to a Button.
Returns:
| Type | Description |
|---|---|
Button
|
Button element |
Source code in flaui/core/automation_elements.py
as_calendar()
Converts the element to a Calendar.
Returns:
| Type | Description |
|---|---|
Calendar
|
Calendar element |
Source code in flaui/core/automation_elements.py
as_check_box()
Converts the element to a CheckBox.
Returns:
| Type | Description |
|---|---|
CheckBox
|
CheckBox element |
Source code in flaui/core/automation_elements.py
as_combo_box()
Converts the element to a ComboBox.
Returns:
| Type | Description |
|---|---|
ComboBox
|
ComboBox element |
Source code in flaui/core/automation_elements.py
as_data_grid_view()
Converts the element to a DataGridView.
Returns:
| Type | Description |
|---|---|
DataGridView
|
DataGridView element |
Source code in flaui/core/automation_elements.py
as_date_time_picker()
Converts the element to a DateTimePicker.
Returns:
| Type | Description |
|---|---|
DateTimePicker
|
DateTimePicker element |
Source code in flaui/core/automation_elements.py
as_grid()
Converts the element to a Grid.
Returns:
| Type | Description |
|---|---|
Grid
|
Grid element |
Source code in flaui/core/automation_elements.py
as_grid_cell()
Converts the element to a GridCell.
Returns:
| Type | Description |
|---|---|
GridCell
|
GridCell element |
Source code in flaui/core/automation_elements.py
as_grid_header_item()
Converts the element to a GridHeaderItem.
Returns:
| Type | Description |
|---|---|
GridHeaderItem
|
GridHeaderItem element |
Source code in flaui/core/automation_elements.py
as_grid_row()
Converts the element to a GridRow.
Returns:
| Type | Description |
|---|---|
GridRow
|
GridRow element |
Source code in flaui/core/automation_elements.py
as_horizontal_scroll_bar()
Converts the element to a HorizontalScrollBar.
Returns:
| Type | Description |
|---|---|
HorizontalScrollBar
|
HorizontalScrollBar element |
Source code in flaui/core/automation_elements.py
as_label()
Converts the element to a Label.
Returns:
| Type | Description |
|---|---|
Label
|
Label element |
Source code in flaui/core/automation_elements.py
as_list_box()
Converts the element to a ListBox.
Returns:
| Type | Description |
|---|---|
ListBox
|
ListBox element |
Source code in flaui/core/automation_elements.py
as_list_box_item()
Converts the element to a ListBoxItem.
Returns:
| Type | Description |
|---|---|
ListBoxItem
|
ListBoxItem element |
Source code in flaui/core/automation_elements.py
as_menu()
Converts the element to a Menu.
Returns:
| Type | Description |
|---|---|
Menu
|
Menu element |
Source code in flaui/core/automation_elements.py
as_menu_item()
Converts the element to a MenuItem.
Returns:
| Type | Description |
|---|---|
MenuItem
|
MenuItem element |
Source code in flaui/core/automation_elements.py
as_progress_bar()
Converts the element to a ProgressBar.
Returns:
| Type | Description |
|---|---|
ProgressBar
|
ProgressBar element |
Source code in flaui/core/automation_elements.py
as_radio_button()
Converts the element to a RadioButton.
Returns:
| Type | Description |
|---|---|
RadioButton
|
RadioButton element |
Source code in flaui/core/automation_elements.py
as_slider()
Converts the element to a Slider.
Returns:
| Type | Description |
|---|---|
Slider
|
Slider element |
Source code in flaui/core/automation_elements.py
as_spinner()
Converts the element to a Spinner.
Returns:
| Type | Description |
|---|---|
Spinner
|
Spinner element |
Source code in flaui/core/automation_elements.py
as_tab()
Converts the element to a Tab.
Returns:
| Type | Description |
|---|---|
Tab
|
Tab element |
Source code in flaui/core/automation_elements.py
as_tab_item()
Converts the element to a TabItem.
Returns:
| Type | Description |
|---|---|
TabItem
|
TabItem element |
Source code in flaui/core/automation_elements.py
as_text_box()
Converts the element to a TextBox.
Returns:
| Type | Description |
|---|---|
TextBox
|
TextBox element |
Source code in flaui/core/automation_elements.py
as_thumb()
Converts the element to a Thumb.
Returns:
| Type | Description |
|---|---|
Thumb
|
Thumb element |
Source code in flaui/core/automation_elements.py
as_title_bar()
Converts the element to a TitleBar.
Returns:
| Type | Description |
|---|---|
TitleBar
|
TitleBar element |
Source code in flaui/core/automation_elements.py
as_toggle_button()
Converts the element to a ToggleButton.
Returns:
| Type | Description |
|---|---|
ToggleButton
|
ToggleButton element |
Source code in flaui/core/automation_elements.py
as_tree()
Converts the element to a Tree.
Returns:
| Type | Description |
|---|---|
Tree
|
Tree element |
Source code in flaui/core/automation_elements.py
as_tree_item()
Converts the element to a TreeItem.
Returns:
| Type | Description |
|---|---|
TreeItem
|
TreeItem element |
Source code in flaui/core/automation_elements.py
as_vertical_scroll_bar()
Converts the element to a VerticalScrollBar.
Returns:
| Type | Description |
|---|---|
VerticalScrollBar
|
VerticalScrollBar element |
Source code in flaui/core/automation_elements.py
as_window()
Converts the element to a Window.
Returns:
| Type | Description |
|---|---|
Window
|
Window element |
Source code in flaui/core/automation_elements.py
capture()
Captures the object as screenshot in Bitmap format.
Returns:
| Type | Description |
|---|---|
Any
|
Captured element image Bitmap object |
capture_to_file(file_path)
Captures the object as screenshot directly into the given file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
The filepath where the screenshot should be saved. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in flaui/core/automation_elements.py
click(move_mouse=False, post_wait=None)
Performs a left click on the element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_mouse
|
bool
|
Flag to indicate, if the mouse should move slowly(True) or instantly(False), defaults to False |
False
|
post_wait
|
Optional[Union[bool, float, Callable[[], None]]]
|
Optional wait after operation. True=100ms, float=custom seconds, callable=custom function |
None
|
Source code in flaui/core/automation_elements.py
double_click(move_mouse=False)
Performs a double left click on the element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_mouse
|
bool
|
Flag to indicate, if the mouse should move slowly(True) or instantly(False), defaults to False |
False
|
Source code in flaui/core/automation_elements.py
draw_highlight(color=Color.Red, duration=2000)
Draw a highlight around the element with the given settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
ColorData
|
Color object, defaults to ColorCollection.Red |
Red
|
duration
|
int
|
Duration to highlight (in ms), defaults to 2000 |
2000
|
Source code in flaui/core/automation_elements.py
equals(another_element)
Compares two elements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
another_element
|
AutomationElement
|
Another element |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True/False |
Source code in flaui/core/automation_elements.py
find_all(tree_scope, condition)
Finds all children with the condition.
:aram tree_scope: Treescope object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
condition
|
PropertyCondition
|
The search condition. |
required |
Returns:
| Type | Description |
|---|---|
AutomationElementCollection
|
The found elements or an empty collection if no elements were found. |
Source code in flaui/core/automation_elements.py
find_all_by_x_path(x_path)
Finds all items which match the given xpath.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_path
|
str
|
Element XPath |
required |
Returns:
| Type | Description |
|---|---|
AutomationElementCollection
|
The found elements or an empty collection if no elements were found. |
Source code in flaui/core/automation_elements.py
find_all_children(condition=None)
Finds all children with the condition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
condition
|
Optional[PropertyCondition]
|
The search condition. |
None
|
Returns:
| Type | Description |
|---|---|
AutomationElementCollection
|
The found elements or an empty collection if no elements were found. |
Source code in flaui/core/automation_elements.py
find_all_descendants(condition=None)
Finds all descendants with the condition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
condition
|
Optional[PropertyCondition]
|
The search condition. |
None
|
Returns:
| Type | Description |
|---|---|
AutomationElementCollection
|
The found elements or an empty collection if no elements were found. |
Source code in flaui/core/automation_elements.py
find_all_nested(condition)
Finds all elements by iterating thru all conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
condition
|
PropertyCondition
|
The search condition. |
required |
Returns:
| Type | Description |
|---|---|
AutomationElementCollection
|
The found elements or an empty collection if no elements were found. |
Source code in flaui/core/automation_elements.py
find_all_with_options(tree_scope, condition, traversal_options, root)
Find all matching elements in the specified order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree_scope
|
TreeScope
|
A combination of values specifying the scope of the search. |
required |
condition
|
PropertyCondition
|
A condition that represents the criteria to match. |
required |
traversal_options
|
TreeTraversalOptions
|
Value specifying the tree navigation order. |
required |
root
|
AutomationElement
|
An element with which to begin the search. |
required |
Returns:
| Type | Description |
|---|---|
AutomationElementCollection
|
The found elements or an empty collection if no elements were found. |
Source code in flaui/core/automation_elements.py
find_at(tree_scope, index, condition)
Finds the element with the given index with the given condition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree_scope
|
TreeScope
|
The scope to search. |
required |
index
|
int
|
The index of the element to return (0-based). |
required |
condition
|
PropertyCondition
|
The condition to use. |
required |
Returns:
| Type | Description |
|---|---|
AutomationElement
|
The found element or null if no element was found. |
Source code in flaui/core/automation_elements.py
find_child_at(index, condition)
Finds the child at the given position with the condition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
The index of the child to find. |
required |
condition
|
PropertyCondition
|
The condition. |
required |
Returns:
| Type | Description |
|---|---|
AutomationElement
|
The found element or null if no element was found. |
Source code in flaui/core/automation_elements.py
find_first(tree_scope, condition)
Finds the first element in the given scope with the given condition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree_scope
|
TreeScope
|
The scope to search. |
required |
condition
|
PropertyCondition
|
The condition to use. |
required |
Returns:
| Type | Description |
|---|---|
AutomationElement
|
The found element or null if no element was found. |
Source code in flaui/core/automation_elements.py
find_first_by_x_path(x_path)
Finds for the first item which matches the given xpath.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_path
|
str
|
XPath to the element |
required |
Returns:
| Type | Description |
|---|---|
AutomationElement
|
The found element or null if no element was found. |
Source code in flaui/core/automation_elements.py
find_first_child(condition=None)
Finds the first child.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
condition
|
Optional[PropertyCondition]
|
The condition to use. |
None
|
Returns:
| Type | Description |
|---|---|
AutomationElement
|
The found element or null if no element was found. |
Source code in flaui/core/automation_elements.py
find_first_descendant(condition=None)
Finds the first descendant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
condition
|
Optional[PropertyCondition]
|
The condition to use. |
None
|
Returns:
| Type | Description |
|---|---|
AutomationElement
|
The found element or null if no element was found. |
Source code in flaui/core/automation_elements.py
find_first_nested(conditions)
Finds the first element by iterating thru all conditions.
C# signature: FindFirstNested(params ConditionBase[] nestedConditions) Iterates through children using each condition in sequence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conditions
|
Union[PropertyCondition, List[PropertyCondition]]
|
Single condition or list of conditions to iterate through. |
required |
Returns:
| Type | Description |
|---|---|
AutomationElement
|
The found element or null if no element was found. |
Source code in flaui/core/automation_elements.py
find_first_with_options(tree_scope, condition, traversal_options, root)
Find first matching element in the specified order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree_scope
|
TreeScope
|
A combination of values specifying the scope of the search. |
required |
condition
|
PropertyCondition
|
A condition that represents the criteria to match. |
required |
traversal_options
|
TreeTraversalOptions
|
Value specifying the tree navigation order. |
required |
root
|
Any
|
An element with which to begin the search. |
required |
Returns:
| Type | Description |
|---|---|
AutomationElement
|
The found element or null if no element was found. |
Source code in flaui/core/automation_elements.py
focus()
Sets the focus to a control. If the control is a window, brings it to the foreground
focus_native()
get_clickable_point()
get_current_metadata_value(property_id, meta_data_id)
Gets metadata from the UI Automation element that indicates how the information should be interpreted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
property_id
|
Any
|
The property to retrieve. |
required |
meta_data_id
|
int
|
Specifies the type of metadata to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The metadata. |
Source code in flaui/core/automation_elements.py
get_hash_code()
Fetches the hash code of the current element
Returns:
| Type | Description |
|---|---|
int
|
Hash code |
get_supported_patterns()
Gets the available patterns for an element via properties.
Returns:
| Type | Description |
|---|---|
Any
|
Available patterns for an element via properties. |
Source code in flaui/core/automation_elements.py
get_supported_patterns_direct()
Gets the available patterns for an element via UIA method. Does not work with cached elements and might be unreliable.
Returns:
| Type | Description |
|---|---|
Any
|
Available patterns |
Source code in flaui/core/automation_elements.py
get_supported_properties_direct()
Gets the available properties for an element via UIA method. Does not work with cached elements and might be unreliable.
Returns:
| Type | Description |
|---|---|
Any
|
Available properties |
Source code in flaui/core/automation_elements.py
get_x_path_navigator()
Return an XPath navigator rooted at this element for manual UIA-tree navigation.
For most use cases prefer :meth:find_first_by_x_path / :meth:find_all_by_x_path; this
exposes the underlying navigator for advanced traversal.
Returns:
| Type | Description |
|---|---|
'AutomationElementXPathNavigator'
|
An :class: |
Source code in flaui/core/automation_elements.py
is_pattern_supported(pattern_id)
Checks if the given pattern is available for the element via properties.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern_id
|
Any
|
Pattern |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if supported else False |
Source code in flaui/core/automation_elements.py
is_pattern_supported_direct(pattern_id)
Checks if the given pattern is available for the element via UIA method. Does not work with cached elements and might be unreliable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern_id
|
Any
|
Pattern ID |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if supported else False |
Source code in flaui/core/automation_elements.py
is_property_supported_direct(property)
Method to check if the element supports the given property via UIA method. Does not work with cached elements and might be unreliable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
property
|
Any
|
Property to check |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if supported else False |
Source code in flaui/core/automation_elements.py
register_active_text_position_changed_event(tree_scope, action)
Register an active-text-position-changed event handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree_scope
|
TreeScope
|
The tree scope to listen on. |
required |
action
|
Callable[['AutomationElement', Any], None]
|
Callback |
required |
Returns:
| Type | Description |
|---|---|
'EventRegistration'
|
An :class: |
Source code in flaui/core/automation_elements.py
register_automation_event(event, tree_scope, action)
Register an automation event handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Any
|
The event to listen for (an |
required |
tree_scope
|
TreeScope
|
The tree scope to listen on. |
required |
action
|
Callable[['AutomationElement', Any], None]
|
Callback |
required |
Returns:
| Type | Description |
|---|---|
'EventRegistration'
|
An :class: |
Source code in flaui/core/automation_elements.py
register_notification_event(tree_scope, action)
Register a notification event handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree_scope
|
TreeScope
|
The tree scope to listen on. |
required |
action
|
Callable[['AutomationElement', Any, Any, str, str], None]
|
Callback |
required |
Returns:
| Type | Description |
|---|---|
'EventRegistration'
|
An :class: |
Source code in flaui/core/automation_elements.py
register_property_changed_event(tree_scope, action, properties)
Register a property-changed event handler for the given properties.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree_scope
|
TreeScope
|
The tree scope to listen on. |
required |
action
|
Callable[['AutomationElement', Any, Any], None]
|
Callback |
required |
properties
|
List[Any]
|
Properties to watch ( |
required |
Returns:
| Type | Description |
|---|---|
'EventRegistration'
|
An :class: |
Source code in flaui/core/automation_elements.py
register_structure_changed_event(tree_scope, action)
Register a structure-changed event handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree_scope
|
TreeScope
|
The tree scope to listen on. |
required |
action
|
Callable[['AutomationElement', Any, List[int]], None]
|
Callback |
required |
Returns:
| Type | Description |
|---|---|
'EventRegistration'
|
An :class: |
Source code in flaui/core/automation_elements.py
register_text_edit_text_changed_event_handler(tree_scope, text_edit_change_type, action)
Register a text-edit text-changed event handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree_scope
|
TreeScope
|
The tree scope to listen on. |
required |
text_edit_change_type
|
Any
|
The C# |
required |
action
|
Callable[['AutomationElement', Any, List[str]], None]
|
Callback |
required |
Returns:
| Type | Description |
|---|---|
'EventRegistration'
|
An :class: |
Source code in flaui/core/automation_elements.py
right_click(move_mouse=False)
Performs a right click on the element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_mouse
|
bool
|
Flag to indicate, if the mouse should move slowly (true) or instantly (false)., defaults to False |
False
|
Source code in flaui/core/automation_elements.py
right_double_click(move_mouse=False)
Performs a double right click on the element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_mouse
|
bool
|
Flag to indicate, if the mouse should move slowly (true) or instantly (false)., defaults to False |
False
|
Source code in flaui/core/automation_elements.py
set_focus()
Sets the focus to a control. If the control is a window, brings it to the foreground
set_foreground()
to_string()
Overrides the string representation of the element with something useful.
Returns:
| Type | Description |
|---|---|
str
|
String object |
try_get_clickable_point()
Tries to get a clickable point of the element.
Returns:
| Type | Description |
|---|---|
Tuple[bool, Point]
|
Tuple[flag, Point] - True if a point was found, false otherwise; The clickable point or null, if no point was found |