poco.sdk.AbstractDumper module

class AbstractDumper[source]

Bases: IDumper

This class partially implements IDumper using general traversal algorithm. In order to dump the hierarchy from the root node, this dumper first retrieves all available attributes of the root node and also the list all its children and then applies the same procedures as described on each child (i.e. treats each child as a root node) until the node that has no child(ren) is reached.


json serializable dict holding the whole hierarchy data

Return type:


dumpHierarchyImpl(node, onlyVisibleNode=True)[source]

Crawl the hierarchy tree using the simple DFS algorithm. The dump procedure is the engine independent as the hierarchy structure is wrapped by AbstractNode and therefore the dump procedure can be algorithmized.

Following code demonstrates the simplest implementation. Feel free to implement your own algorithms to optimize the performance.


Do not explicitly call this method as this is an internal function, call dumpHierarchy() function instead if you want to dump the hierarchy.

  • node (inherit from AbstractNode) – root node of the hierarchy to be dumped

  • onlyVisibleNode (bool) – dump only the visible nodes or all nodes, default to True


json serializable dict holding the whole hierarchy data

Return type:


class IDumper[source]

Bases: object

This interface defines the standard dumper behavior. Dumper class is introduced to get the hierarchy information and convert it into serializable data.


Return the json serializable dictionary holding the hierarchy data. Refer to sample of returned structure object below.

Structure of the dict:

    # name can be duplicated from the original name or just left the default one
    # if it cannot be determined, however providing some meaningful name is preferred
    'name': '<a recognizable string>'

    # All available attributes of this node are in form of key-value pairs
    'payload': {
        'name': '',
        'pos': [0, 0],
        'size': [1, 1],

    # If there is no child, this part can be omitted
    'children': [
        {...},  # Same structure as this dict.

hierarchy data or None

Return type:

dict or NoneType


Return the root node of the UI Hierarchy. The node information is wrapped by AbstractNode. See definition of AbstractNode for more details.


instance that holds the hierarchy data

Return type:

inherit from AbstractNode