XPath Navigator
Wraps the C# AutomationElementXPathNavigator for manual XPath-based navigation of the UI
Automation tree. For most use cases prefer
find_first_by_x_path / find_all_by_x_path; obtain a navigator with
element.get_x_path_navigator().
flaui.core.xpath_navigator.AutomationElementXPathNavigator
Bases: BaseModel
Wraps the C# AutomationElementXPathNavigator for XPath-based tree navigation.
current_element
property
Return the element at the navigator's current position.
Returns:
| Type | Description |
|---|---|
'AutomationElement'
|
The current :class: |
name
property
Return the name of the current node (its control type, or attribute name).
Returns:
| Type | Description |
|---|---|
str
|
The node name. |
node_type
property
Return the XPath node type of the current node (e.g. Root, Element).
Returns:
| Type | Description |
|---|---|
str
|
The node type as a string. |
value
property
Return the string value of the current node.
Returns:
| Type | Description |
|---|---|
str
|
The node value. |
clone()
Return an independent copy of this navigator at the same position.
Returns:
| Type | Description |
|---|---|
'AutomationElementXPathNavigator'
|
A cloned navigator. |
Source code in flaui/core/xpath_navigator.py
from_element(element)
classmethod
Create a navigator rooted at the given element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
element
|
'AutomationElement'
|
The element to use as the navigation root. |
required |
Returns:
| Type | Description |
|---|---|
'AutomationElementXPathNavigator'
|
A new :class: |
Source code in flaui/core/xpath_navigator.py
get_attribute(name)
Return the value of a named attribute on the current element.
Supported attribute names mirror the C# navigator: AutomationId, Name, ClassName,
HelpText, IsPassword, FullDescription, ItemType, AcceleratorKey,
AccessKey, IsEnabled, IsOffscreen, ProcessId.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The attribute name. |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The attribute value, or an empty string when unset. |
Source code in flaui/core/xpath_navigator.py
move_to_first_child()
Move to the first child of the current element.
Returns:
| Type | Description |
|---|---|
bool
|
|
move_to_next()
Move to the next sibling of the current element.
Returns:
| Type | Description |
|---|---|
bool
|
|
move_to_parent()
Move to the parent of the current element.
Returns:
| Type | Description |
|---|---|
bool
|
|
move_to_previous()
Move to the previous sibling of the current element.
Returns:
| Type | Description |
|---|---|
bool
|
|