Patterns
Python wrappers around the C# FlaUI.Core.Patterns types. The Patterns facade (exposed as
element.patterns) gives typed, snake_case access to each UI Automation pattern, mirroring the C#
element.Patterns.<Pattern>.Pattern shape one-to-one:
# C#: element.Patterns.Value.Pattern.Value.Value
element.patterns.value.pattern.value.value
# C#: element.Patterns.Toggle.IsSupported
element.patterns.toggle.is_supported
Each pattern wraps a native C# pattern object, always reachable via raw_pattern as an escape
hatch for members that are not yet wrapped. Patterns are ported incrementally by family.
Pattern parity
The wrapper covers all 34 patterns that FlaUI exposes through
FrameworkAutomationElementBase.IFrameworkPatterns — full parity with the FlaUI C# API.
The Microsoft UIA CustomNavigation pattern is intentionally not included: FlaUI itself
does not surface it (it lives only in the underlying Interop.UIAutomationClient COM layer), so
wrapping it would break the 1:1-with-FlaUI mapping. It is tracked as a post-v1 wishlist item in
GH-121.
flaui.core.patterns
Python wrappers for FlaUI C# UI Automation patterns.
This package mirrors FlaUI.Core.Patterns. The :class:~flaui.core.patterns.patterns.Patterns
facade (exposed as element.patterns) gives typed, snake_case access to each pattern, matching
the C# element.Patterns.<Pattern>.Pattern shape. Each pattern wraps a native C# pattern object
reachable via :attr:~flaui.core.patterns.pattern_base.PatternBase.raw_pattern.
All UI Automation patterns from FlaUI.Core.Patterns are wrapped here.
AnnotationPattern
Bases: PatternBase
Represents the UI Automation Annotation pattern for annotation elements (comments, etc.).
annotation_type
property
Return the annotation type identifier.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
annotation_type_name
property
Return the localized annotation type name.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
author
property
Return the author of the annotation.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
date_time
property
Return the date and time the annotation was created.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
target
property
Return the element the annotation targets.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
AutomationPattern
Bases: BaseModel, Generic[TPattern]
Provides access to a single pattern on an element, mirroring C# IAutomationPattern<T>.
is_supported
property
Return whether the element supports this pattern.
Returns:
| Type | Description |
|---|---|
bool
|
|
pattern
property
Return the wrapped pattern, raising if the pattern is not supported.
Returns:
| Type | Description |
|---|---|
TPattern
|
The wrapped pattern instance. |
Raises:
| Type | Description |
|---|---|
PatternNotSupportedException
|
If the element does not support the pattern. |
pattern_or_default
property
Return the wrapped pattern, or None if the pattern is not supported.
Returns:
| Type | Description |
|---|---|
Optional[TPattern]
|
The wrapped pattern instance, or |
try_get_pattern()
Try to get the wrapped pattern.
Returns:
| Type | Description |
|---|---|
Tuple[bool, Optional[TPattern]]
|
A tuple |
DockPattern
Bases: PatternBase
Represents the UI Automation Dock pattern for controls docked within a docking container.
dock_position
property
Return the control's current dock position.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
set_dock_position(dock_position)
Set the control's dock position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dock_position
|
DockPosition
|
The desired dock position. |
required |
Source code in flaui/core/patterns/dock_pattern.py
DragPattern
Bases: PatternBase
Represents the UI Automation Drag pattern for elements that can be dragged.
drop_effect
property
Return a localized description of the drop effect when dragging.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
drop_effects
property
Return the full set of localized drop effect descriptions.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
grabbed_items
property
Return the items being dragged together with this element.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
is_grabbed
property
Return whether the element is currently grabbed for dragging.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
DropTargetPattern
Bases: PatternBase
Represents the UI Automation DropTarget pattern for elements that accept drops.
drop_target_effect
property
Return a localized description of the effect when dropping onto this target.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
drop_target_effects
property
Return the full set of localized drop target effect descriptions.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
ExpandCollapsePattern
Bases: PatternBase
Represents the UI Automation ExpandCollapse pattern for controls that expand and collapse.
expand_collapse_state
property
Return the current expand/collapse state.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
collapse()
GridItemPattern
Bases: PatternBase
Represents the UI Automation GridItem pattern for a single cell within a grid.
column
property
Return the zero-based column index of the cell.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
column_span
property
Return the number of columns the cell spans.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
containing_grid
property
Return the grid that contains the cell.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
row
property
Return the zero-based row index of the cell.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
row_span
property
Return the number of rows the cell spans.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
GridPattern
Bases: PatternBase
Represents the UI Automation Grid pattern for controls arranged in a grid of cells.
column_count
property
Return the number of columns in the grid.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
row_count
property
Return the number of rows in the grid.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
get_item(row, column)
Return the cell at the given zero-based row and column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
Zero-based row index. |
required |
column
|
int
|
Zero-based column index. |
required |
Returns:
| Type | Description |
|---|---|
AutomationElement
|
The :class: |
Source code in flaui/core/patterns/grid_pattern.py
InvokePattern
Bases: PatternBase
Represents the UI Automation Invoke pattern for controls that perform a single action.
ItemContainerPattern
Bases: PatternBase
Represents the UI Automation ItemContainer pattern for efficient item lookup in containers.
find_item_by_property(start_after, property_id, value)
Find an item by a property value, optionally starting after a given item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_after
|
Optional['AutomationElement']
|
The item to start searching after, or |
required |
property_id
|
Any
|
The C# |
required |
value
|
Any
|
The property value to match (or |
required |
Returns:
| Type | Description |
|---|---|
Optional['AutomationElement']
|
The matching :class: |
Source code in flaui/core/patterns/item_container_pattern.py
LegacyIAccessiblePattern
Bases: PatternBase
Represents the UI Automation LegacyIAccessible pattern bridging to MSAA IAccessible.
child_id
property
Return the MSAA child id of the element.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
default_action
property
Return the element's default action description.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
description
property
Return the element's description.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
help
property
Return the element's help text.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
keyboard_shortcut
property
Return the element's keyboard shortcut.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
name
property
Return the element's MSAA name.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
role
property
Return the element's MSAA role.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
selection
property
Return the selected child elements.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
state
property
Return the element's MSAA state.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
value
property
Return the element's MSAA value.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
do_default_action()
select(flags_select)
Modify the selection using MSAA SELFLAG flags.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flags_select
|
int
|
The MSAA |
required |
Source code in flaui/core/patterns/legacy_i_accessible_pattern.py
set_value(value)
Set the element's value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The value to set. |
required |
MultipleViewPattern
Bases: PatternBase
Represents the UI Automation MultipleView pattern for controls with several presentations.
current_view
property
Return the identifier of the current view.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
supported_views
property
Return the identifiers of all supported views.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
get_view_name(view)
Return the localized name of a view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
|
int
|
The view identifier. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The view's localized name. |
Source code in flaui/core/patterns/multiple_view_pattern.py
set_current_view(view)
Switch the control to the given view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
|
int
|
The view identifier to switch to. |
required |
ObjectModelPattern
Bases: PatternBase
Represents the UI Automation ObjectModel pattern, exposing a control's underlying object model.
get_underlying_object_model()
Return the control's underlying object model.
Returns:
| Type | Description |
|---|---|
Any
|
The native object model (a COM/.NET object specific to the control). |
Source code in flaui/core/patterns/object_model_pattern.py
PatternBase
Bases: BaseModel, ABC
Base model wrapping a native C# FlaUI pattern object.
validate_pattern_exists(v, info)
Validate the native pattern object exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Any
|
Raw C# pattern object. |
required |
info
|
ValidationInfo
|
Pydantic validation info. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The validated raw pattern object. |
Raises:
| Type | Description |
|---|---|
PatternNotSupportedException
|
If the pattern object is |
Source code in flaui/core/patterns/pattern_base.py
Patterns
Bases: BaseModel
Provides typed access to the UI Automation patterns of an element.
annotation
property
Access the Annotation pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[AnnotationPattern]
|
The Annotation pattern accessor. |
dock
property
Access the Dock pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[DockPattern]
|
The Dock pattern accessor. |
drag
property
Access the Drag pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[DragPattern]
|
The Drag pattern accessor. |
drop_target
property
Access the DropTarget pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[DropTargetPattern]
|
The DropTarget pattern accessor. |
expand_collapse
property
Access the ExpandCollapse pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[ExpandCollapsePattern]
|
The ExpandCollapse pattern accessor. |
grid
property
Access the Grid pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[GridPattern]
|
The Grid pattern accessor. |
grid_item
property
Access the GridItem pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[GridItemPattern]
|
The GridItem pattern accessor. |
invoke
property
Access the Invoke pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[InvokePattern]
|
The Invoke pattern accessor. |
item_container
property
Access the ItemContainer pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[ItemContainerPattern]
|
The ItemContainer pattern accessor. |
legacy_i_accessible
property
Access the LegacyIAccessible pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[LegacyIAccessiblePattern]
|
The LegacyIAccessible pattern accessor. |
multiple_view
property
Access the MultipleView pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[MultipleViewPattern]
|
The MultipleView pattern accessor. |
object_model
property
Access the ObjectModel pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[ObjectModelPattern]
|
The ObjectModel pattern accessor. |
range_value
property
Access the RangeValue pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[RangeValuePattern]
|
The RangeValue pattern accessor. |
scroll
property
Access the Scroll pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[ScrollPattern]
|
The Scroll pattern accessor. |
scroll_item
property
Access the ScrollItem pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[ScrollItemPattern]
|
The ScrollItem pattern accessor. |
selection
property
Access the Selection pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[SelectionPattern]
|
The Selection pattern accessor. |
selection2
property
Access the Selection2 pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[Selection2Pattern]
|
The Selection2 pattern accessor. |
selection_item
property
Access the SelectionItem pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[SelectionItemPattern]
|
The SelectionItem pattern accessor. |
spreadsheet
property
Access the Spreadsheet pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[SpreadsheetPattern]
|
The Spreadsheet pattern accessor. |
spreadsheet_item
property
Access the SpreadsheetItem pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[SpreadsheetItemPattern]
|
The SpreadsheetItem pattern accessor. |
styles
property
Access the Styles pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[StylesPattern]
|
The Styles pattern accessor. |
synchronized_input
property
Access the SynchronizedInput pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[SynchronizedInputPattern]
|
The SynchronizedInput pattern accessor. |
table
property
Access the Table pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[TablePattern]
|
The Table pattern accessor. |
table_item
property
Access the TableItem pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[TableItemPattern]
|
The TableItem pattern accessor. |
text
property
Access the Text pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[TextPattern]
|
The Text pattern accessor. |
text2
property
Access the Text2 pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[Text2Pattern]
|
The Text2 pattern accessor. |
text_child
property
Access the TextChild pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[TextChildPattern]
|
The TextChild pattern accessor. |
text_edit
property
Access the TextEdit pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[TextEditPattern]
|
The TextEdit pattern accessor. |
toggle
property
Access the Toggle pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[TogglePattern]
|
The Toggle pattern accessor. |
transform
property
Access the Transform pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[TransformPattern]
|
The Transform pattern accessor. |
transform2
property
Access the Transform2 pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[Transform2Pattern]
|
The Transform2 pattern accessor. |
value
property
Access the Value pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[ValuePattern]
|
The Value pattern accessor. |
virtualized_item
property
Access the VirtualizedItem pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[VirtualizedItemPattern]
|
The VirtualizedItem pattern accessor. |
window
property
Access the Window pattern.
Returns:
| Type | Description |
|---|---|
AutomationPattern[WindowPattern]
|
The Window pattern accessor. |
RangeValuePattern
Bases: PatternBase
Represents the UI Automation RangeValue pattern for controls with a numeric range (e.g. sliders).
is_read_only
property
Return whether the value is read-only.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
large_change
property
Return the value added or subtracted on a large change.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
maximum
property
Return the maximum value of the range.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
minimum
property
Return the minimum value of the range.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
small_change
property
Return the value added or subtracted on a small change.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
value
property
Return the current value.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
set_value(value)
Set the control's value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
The numeric value to set. |
required |
ScrollItemPattern
Bases: PatternBase
Represents the UI Automation ScrollItem pattern for items that can scroll into view.
scroll_into_view()
ScrollPattern
Bases: PatternBase
Represents the UI Automation Scroll pattern for controls that scroll their content.
horizontal_scroll_percent
property
Return the horizontal scroll position as a percentage.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
horizontal_view_size
property
Return the horizontal viewport size as a percentage of the total content.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
horizontally_scrollable
property
Return whether the control can scroll horizontally.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
vertical_scroll_percent
property
Return the vertical scroll position as a percentage.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
vertical_view_size
property
Return the vertical viewport size as a percentage of the total content.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
vertically_scrollable
property
Return whether the control can scroll vertically.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
scroll(horizontal_amount, vertical_amount)
Scroll the content by the given horizontal and vertical amounts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
horizontal_amount
|
ScrollAmount
|
The horizontal scroll amount. |
required |
vertical_amount
|
ScrollAmount
|
The vertical scroll amount. |
required |
Source code in flaui/core/patterns/scroll_pattern.py
set_scroll_percent(horizontal_percent, vertical_percent)
Set the scroll position as horizontal and vertical percentages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
horizontal_percent
|
float
|
The horizontal scroll position (0-100), or |
required |
vertical_percent
|
float
|
The vertical scroll position (0-100), or |
required |
Source code in flaui/core/patterns/scroll_pattern.py
Selection2Pattern
Bases: SelectionPattern
Extends the Selection pattern with current/first/last selected item and item-count info.
current_selected_item
property
Return the currently selected item.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
first_selected_item
property
Return the first selected item.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
item_count
property
Return the number of selected items.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
last_selected_item
property
Return the last selected item.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
SelectionItemPattern
Bases: PatternBase
Represents the UI Automation SelectionItem pattern for individually selectable items.
is_selected
property
Return whether the item is selected.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
selection_container
property
Return the container that holds the item.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
add_to_selection()
remove_from_selection()
SelectionPattern
Bases: PatternBase
Represents the UI Automation Selection pattern for containers of selectable items.
can_select_multiple
property
Return whether the container allows multiple items to be selected.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
is_selection_required
property
Return whether the container requires at least one item to be selected.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
selection
property
Return the currently selected items.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
SpreadsheetItemPattern
Bases: PatternBase
Represents the UI Automation SpreadsheetItem pattern for a single spreadsheet cell.
annotation_objects
property
Return the annotation elements associated with the cell.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
annotation_types
property
Return the annotation type identifiers associated with the cell.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
formula
property
Return the formula of the cell.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
SpreadsheetPattern
Bases: PatternBase
Represents the UI Automation Spreadsheet pattern for accessing cells by name.
get_item_by_name(name)
Return the spreadsheet cell with the given name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the cell (e.g. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The matching :class: |
Source code in flaui/core/patterns/spreadsheet_pattern.py
StylesPattern
Bases: PatternBase
Represents the UI Automation Styles pattern for elements with visual styling (e.g. cells).
extended_properties
property
Return extended style properties as a string.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
fill_color
property
Return the fill color of the element.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
fill_pattern_color
property
Return the fill pattern color of the element.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
fill_pattern_style
property
Return the fill pattern style name.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
shape
property
Return the shape of the element.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
style
property
Return the style identifier of the element.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
style_name
property
Return the localized style name of the element.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
SynchronizedInputPattern
Bases: PatternBase
Represents the UI Automation SynchronizedInput pattern for coordinating input events.
cancel()
start_listening(input_type)
Begin listening for the given type of synchronized input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_type
|
SynchronizedInputType
|
The type of input event to listen for. |
required |
Source code in flaui/core/patterns/synchronized_input_pattern.py
TableItemPattern
Bases: PatternBase
Represents the UI Automation TableItem pattern for a cell that knows its header items.
column_header_items
property
Return the column header items associated with the cell.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
row_header_items
property
Return the row header items associated with the cell.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
TablePattern
Bases: PatternBase
Represents the UI Automation Table pattern for grids that expose header information.
column_headers
property
Return the column header elements of the table.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
row_headers
property
Return the row header elements of the table.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
row_or_column_major
property
Return whether the table is row-major or column-major.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
Text2Pattern
Bases: TextPattern
Extends the Text pattern with caret and annotation range lookups.
get_caret_range()
Return the text range of the caret and whether the caret is active.
Returns:
| Type | Description |
|---|---|
Tuple[TextRange, bool]
|
A tuple |
Source code in flaui/core/patterns/text2_pattern.py
range_from_annotation(annotation)
Return the text range associated with an annotation element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
annotation
|
'AutomationElement'
|
The annotation element. |
required |
Returns:
| Type | Description |
|---|---|
TextRange
|
A :class: |
Source code in flaui/core/patterns/text2_pattern.py
TextChildPattern
Bases: PatternBase
Represents the UI Automation TextChild pattern for elements embedded inside text content.
text_container
property
Return the nearest ancestor that supports the Text pattern.
Returns:
| Type | Description |
|---|---|
Any
|
The containing :class: |
text_range
property
Return the text range that encloses this child element.
Returns:
| Type | Description |
|---|---|
TextRange
|
A :class: |
TextEditPattern
Bases: TextPattern
Extends the Text pattern with access to in-progress text composition (IME) ranges.
get_active_composition()
Return the text range of the active text composition, if any.
Returns:
| Type | Description |
|---|---|
Optional[TextRange]
|
The active composition :class: |
Source code in flaui/core/patterns/text_edit_pattern.py
get_conversion_target()
Return the text range of the current conversion target, if any.
Returns:
| Type | Description |
|---|---|
Optional[TextRange]
|
The conversion target :class: |
Source code in flaui/core/patterns/text_edit_pattern.py
TextPattern
Bases: PatternBase
Represents the UI Automation Text pattern for controls that expose rich text content.
document_range
property
Return a text range spanning the entire document.
Returns:
| Type | Description |
|---|---|
TextRange
|
A :class: |
supported_text_selection
property
Return the kind of text selection the control supports.
Returns:
| Type | Description |
|---|---|
SupportedTextSelection
|
The supported text selection mode. |
get_selection()
Return the currently selected text ranges.
Returns:
| Type | Description |
|---|---|
List[TextRange]
|
A list of selected :class: |
Source code in flaui/core/patterns/text_pattern.py
get_visible_ranges()
Return the text ranges that are currently visible.
Returns:
| Type | Description |
|---|---|
List[TextRange]
|
A list of visible :class: |
Source code in flaui/core/patterns/text_pattern.py
range_from_child(child)
Return the text range that encloses a child element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
child
|
'AutomationElement'
|
The child element to locate. |
required |
Returns:
| Type | Description |
|---|---|
TextRange
|
A :class: |
Source code in flaui/core/patterns/text_pattern.py
range_from_point(point)
Return the degenerate text range nearest to a screen point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
Point
|
The screen point to locate. |
required |
Returns:
| Type | Description |
|---|---|
TextRange
|
A :class: |
Source code in flaui/core/patterns/text_pattern.py
TogglePattern
Bases: PatternBase
Represents the UI Automation Toggle pattern for controls that cycle through states.
toggle_state
property
Return the current toggle state.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
Transform2Pattern
Bases: TransformPattern
Extends the Transform pattern with zoom capabilities.
can_zoom
property
Return whether the control can be zoomed.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
zoom_level
property
Return the current zoom level.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
zoom_maximum
property
Return the maximum zoom level.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
zoom_minimum
property
Return the minimum zoom level.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
zoom(zoom)
Zoom the control to the given level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zoom
|
float
|
The target zoom level. |
required |
zoom_by_unit(zoom_unit)
Zoom the control by a discrete unit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zoom_unit
|
ZoomUnit
|
The zoom unit (increment/decrement amount). |
required |
Source code in flaui/core/patterns/transform2_pattern.py
TransformPattern
Bases: PatternBase
Represents the UI Automation Transform pattern for movable, resizable, rotatable controls.
can_move
property
Return whether the control can be moved.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
can_resize
property
Return whether the control can be resized.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
can_rotate
property
Return whether the control can be rotated.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
move(x, y)
Move the control to the given screen coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
The target x-coordinate. |
required |
y
|
float
|
The target y-coordinate. |
required |
Source code in flaui/core/patterns/transform_pattern.py
resize(width, height)
Resize the control to the given dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
float
|
The target width. |
required |
height
|
float
|
The target height. |
required |
Source code in flaui/core/patterns/transform_pattern.py
rotate(degrees)
Rotate the control by the given number of degrees.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
degrees
|
float
|
The rotation in degrees. |
required |
ValuePattern
Bases: PatternBase
Represents the UI Automation Value pattern for reading and setting a control's text value.
is_read_only
property
Return whether the value is read-only.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
value
property
Return the current value.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
set_value(value)
Set the control's value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The value to set. |
required |
VirtualizedItemPattern
Bases: PatternBase
Represents the UI Automation VirtualizedItem pattern for items that can be realized on demand.
realize()
Realize the virtualized item, making it a full member of the automation tree.
WindowPattern
Bases: PatternBase
Represents the UI Automation Window pattern for top-level and child windows.
can_maximize
property
Return whether the window can be maximized.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
can_minimize
property
Return whether the window can be minimized.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
is_modal
property
Return whether the window is modal.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
is_topmost
property
Return whether the window is top-most.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
window_interaction_state
property
Return the window's current interaction state.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
window_visual_state
property
Return the window's current visual state.
Returns:
| Type | Description |
|---|---|
AutomationProperty
|
An :class: |
close()
set_window_visual_state(state)
Set the window's visual state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
WindowVisualState
|
The desired visual state (normal, maximized, or minimized). |
required |
Source code in flaui/core/patterns/window_pattern.py
wait_for_input_idle(milliseconds)
Wait until the window is ready to accept input, or the timeout elapses.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
milliseconds
|
int
|
The maximum time to wait, in milliseconds. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in flaui/core/patterns/window_pattern.py
Text ranges
The Text patterns (TextPattern, Text2Pattern, TextEditPattern, TextChildPattern) return
TextRange objects, the Python wrapper around C# ITextRange.
flaui.core.text_range
Python wrapper for the C# FlaUI.Core.ITextRange type.
A text range represents a contiguous span of text within a control that supports the Text pattern.
The wrapper mirrors ITextRange one-to-one; the native object stays reachable via
:attr:TextRange.raw_text_range.
TextRange
Bases: BaseModel
Represents a span of text within a Text-pattern control (mirrors C# ITextRange).
add_to_selection()
clone()
Return a copy of the text range.
Returns:
| Type | Description |
|---|---|
'TextRange'
|
A new :class: |
compare(range)
Return whether this range spans the same text as another.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
range
|
'TextRange'
|
The range to compare against. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in flaui/core/text_range.py
compare_endpoints(src_endpoint, target_range, target_endpoint)
Compare an endpoint of this range with an endpoint of another range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src_endpoint
|
TextPatternRangeEndpoint
|
The endpoint of this range to compare. |
required |
target_range
|
'TextRange'
|
The other range. |
required |
target_endpoint
|
TextPatternRangeEndpoint
|
The endpoint of the other range to compare. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Negative, zero, or positive if this endpoint is before, at, or after the target. |
Source code in flaui/core/text_range.py
expand_to_enclosing_unit(text_unit)
Expand the range to the nearest enclosing unit boundary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text_unit
|
TextUnit
|
The text unit to expand to. |
required |
Source code in flaui/core/text_range.py
find_attribute(attribute, value, backward)
Find a sub-range with the given text attribute value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attribute
|
Any
|
The C# |
required |
value
|
Any
|
The attribute value to match. |
required |
backward
|
bool
|
Search backward from the end when |
required |
Returns:
| Type | Description |
|---|---|
Optional['TextRange']
|
The matching :class: |
Source code in flaui/core/text_range.py
find_text(text, backward, ignore_case)
Find a sub-range containing the given text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to find. |
required |
backward
|
bool
|
Search backward from the end when |
required |
ignore_case
|
bool
|
Match case-insensitively when |
required |
Returns:
| Type | Description |
|---|---|
Optional['TextRange']
|
The matching :class: |
Source code in flaui/core/text_range.py
get_attribute_value(attribute)
Return the value of a text attribute over the range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attribute
|
Any
|
The C# |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The attribute value (a mixed value if the attribute varies over the range). |
Source code in flaui/core/text_range.py
get_bounding_rectangles()
Return the bounding rectangles of the text in the range.
Returns:
| Type | Description |
|---|---|
List[Rectangle]
|
A list of :class: |
Source code in flaui/core/text_range.py
get_children()
Return the embedded child elements within the range.
Returns:
| Type | Description |
|---|---|
List[Any]
|
A list of child automation elements. |
Source code in flaui/core/text_range.py
get_enclosing_element()
Return the innermost element that encloses the range.
Returns:
| Type | Description |
|---|---|
Any
|
The enclosing :class: |
Source code in flaui/core/text_range.py
get_text(max_length=-1)
Return the plain text of the range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_length
|
int
|
Maximum number of characters to return, or |
-1
|
Returns:
| Type | Description |
|---|---|
str
|
The text of the range. |
Source code in flaui/core/text_range.py
move(unit, count)
Move the range by the given number of text units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit
|
TextUnit
|
The unit to move by. |
required |
count
|
int
|
The number of units to move (negative moves backward). |
required |
Returns:
| Type | Description |
|---|---|
int
|
The number of units actually moved. |
Source code in flaui/core/text_range.py
move_endpoint_by_range(src_endpoint, target_range, target_endpoint)
Move an endpoint of this range to an endpoint of another range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src_endpoint
|
TextPatternRangeEndpoint
|
The endpoint of this range to move. |
required |
target_range
|
'TextRange'
|
The range whose endpoint becomes the new position. |
required |
target_endpoint
|
TextPatternRangeEndpoint
|
The endpoint of the target range to move to. |
required |
Source code in flaui/core/text_range.py
move_endpoint_by_unit(endpoint, unit, count)
Move an endpoint of the range by the given number of text units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
endpoint
|
TextPatternRangeEndpoint
|
The endpoint to move. |
required |
unit
|
TextUnit
|
The unit to move by. |
required |
count
|
int
|
The number of units to move (negative moves backward). |
required |
Returns:
| Type | Description |
|---|---|
int
|
The number of units actually moved. |
Source code in flaui/core/text_range.py
remove_from_selection()
scroll_into_view(align_to_top)
Scroll the range into view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
align_to_top
|
bool
|
Align the range to the top of the viewport when |
required |
Source code in flaui/core/text_range.py
select()
validate_text_range_exists(v, info)
Validate the native text range exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Any
|
Raw C# ITextRange object. |
required |
info
|
ValidationInfo
|
Pydantic validation info. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The validated raw text range. |
Raises:
| Type | Description |
|---|---|
ElementNotFound
|
If the text range is |