ElementQuery
Use ElementQuery to form a query into the tree of UI elements and then locate one or multiple matching elements.
ElementQuery uses the builder pattern to concatenate criteria, such as searching for descendants, or matching elements only with a certain id.
Construct an instance of this by calling query_descendants. Apply additional criterial on the returned ElementQuery
and fetch results by either calling find_first to collect just the first match or
find_all to collect all matches for the query.
Methods
Section titled “Methods”match_descendants
Section titled “match_descendants”match_descendants() -> ElementQueryApplies any subsequent matches to all descendants of the results of the query up to this point.
match_id
Section titled “match_id”match_id(id: str) -> ElementQueryInclude only elements in the results where id is equal to the provided id.
match_type_name
Section titled “match_type_name”match_type_name(type_name: str) -> ElementQueryInclude only elements in the results where type_name is equal to the provided type_name.
match_inherits
Section titled “match_inherits”match_inherits(type_name: str) -> ElementQueryInclude only elements in the results where type_name or bases is contains to the provided type_name.
match_accessible_role
Section titled “match_accessible_role”match_accessible_role(role: AccessibleRole) -> ElementQueryInclude only elements in the results where accessible_role is equal to the provided role.
find_first
Section titled “find_first”find_first() -> Optional[Element]Runs the query and returns the first result; returns None if no element matches the selected criteria.
find_all
Section titled “find_all”find_all() -> List[Element]Runs the query and returns a list of all matching elements.
© 2026 SixtyFPS GmbH