poco.sdk.interfaces.hierarchy module¶
-
class
HierarchyInterface[源代码]¶ 基类:
objectThis is one of the main communication interfaces. This interface defines hierarchy-related behaviour assembling from
IDumper,AttributorandSelector. The hierarchy mentioned is the real hierarchy on target app runtime, e.g. a game UI hierarchy in its runtime.-
dump()[源代码]¶ Get the UI hierarchy with its origin structure and attributes, then store the structure and attributes into a json serializable dictionary.
返回: dict representing the hierarchy structure. Structure specification refers to IDumper.返回类型: dict
-
getAttr(nodes, name)[源代码]¶ Get attribute of UI element.
参数: - 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)[源代码]¶ Select UI element(s) matching the given query expression and return the list of selected UI element(s)
参数: - 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
返回: list of UI elements corresponding to the given query expression
返回类型: list- query (
-
setAttr(nodes, name, value)[源代码]¶ Set attribute of UI element.
参数: - 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
-