poco.freezeui.hierarchy module

class FrozenUIDumper[source]

Bases: AbstractDumper

Partially implementation of IDumper. This is only a helper that helps to make dumper work with local nodes just like with remote nodes. The local nodes is an implementation of AbstractNode locally with fixed hierarchy data in arbitrary data type. In a word, this class is not going to crawl hierarchy from target app, but to perform like a ordinary dumper.

dumpHierarchy(onlyVisibleNode=True)[source]
Returns:

json serializable dict holding the whole hierarchy data

Return type:

dict

getRoot()[source]

Dump a hierarchy immediately from target runtime and store into a Node (subclass of AbstractNode) object.

Returns:

Each time a new node instance is created by latest hierarchy

data.

Return type:

inherit from AbstractNode

class FrozenUIHierarchy(dumper, attributor=None)[source]

Bases: HierarchyInterface

Locally implementation of hierarchy interface with a given dumper and all other behaviours by default. As all information can only be retrieve from a fixed UI hierarchy data created by dumper and all UI elements are immutable, this class is called frozen hierarchy. With the help of this class, only very few of the methods are required to implement. See AbstractNode or poco-sdk integration guide to get more details about this.

This class makes it much easier to integrate poco-sdk and optimizes performance in some situations, but it is not sensitive enough to the changes of UI hierarchy in the app. For example, you should call select explicitly to re-crawl a new UI hierarchy when some UI elements changed on screen. Otherwise you are using attributes that are out of date.

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 node attribute

select(query, multiple=False)[source]

select nodes by query

setAttr(nodes, name, value)[source]

set node attribute