poco.sdk.interfaces.hierarchy module¶
-
class
HierarchyInterface
[source]¶ Bases:
object
This is one of the main communication interfaces. This interface defines hierarchy-related behaviour assembling from
IDumper
,Attributor
andSelector
. The hierarchy mentioned is the real hierarchy on target app runtime, e.g. a game UI hierarchy in its runtime.-
dump
()[source]¶ Get the UI hierarchy with its origin structure and attributes, then store the structure and attributes into a json serializable dictionary.
Returns: dict representing the hierarchy structure. Structure specification refers to IDumper
.Return type: dict
-
getAttr
(nodes, name)[source]¶ Get attribute of UI element.
Parameters: - nodes – UI element or list of UI elements, if there is a list of UI elements provided, then only the first UI element will be used
- name (
str
) – attribute name
-
select
(query, multiple)[source]¶ Select UI element(s) matching the given query expression and return the list of selected UI element(s)
Parameters: - query (
tuple
) – query expression, for the structure specification refer toSelector
. - multiple (
bool
) – whether or not to select multiple elements, if False, the method terminates immediately once the node is found, otherwise the method travers through all nodes and then terminates
Returns: list of UI elements corresponding to the given query expression
Return type: list
- query (
-
setAttr
(nodes, name, value)[source]¶ Set attribute of UI element.
Parameters: - nodes – UI element or list of UI elements, if there is a list of UI elements provided, then only the first UI element will be used
- name (
str
) – attribute name - value – new value to be set.
Raises: UnableToSetAttributeException
– raised when:- fails to set attributes on given UI element
- the engine does not support mutating attributes
- developer does not allow to change the attribute value by implementation
-