Snapshots and the event log¶
Screen snapshots with refs and the connection's event log, for tools that drive a device over several processes. Guide: Held connections and screen snapshots.
ScreenSnapshot
¶
The visible screen as ref-addressed nodes (Device.screen_snapshot()). removed
lists the previous snapshot's nodes that are gone; their refs no longer resolve.
snapshot_id increases per attached device.
Methods:
| Name | Description |
|---|---|
node |
The node with |
display_width
¶
display_width: int
The display's width in pixels when the snapshot was taken, as rotated; 0 when unknown.
node
¶
node(ref: str) -> ScreenNode | None
The node with ref (with or without the leading @), or None.
ScreenNode
¶
One visible node of a ScreenSnapshot, in dump (pre-order) order.
ref (e<N>) stays the same across snapshots while the node is unchanged and is never
reused for another node. selector is one the daemon found to match only this node in the
dump (None when there is none); by_index marks one that ends in an index pick, which is
right for this dump but fragile if the screen reorders. window_package is the package of
the window the node is in. interactive: the node accepts input of its own: editable,
clickable, long-clickable, checkable or scrollable, or it offers a custom action or a standard
one that acts on it (focus, selection, copy and show-on-screen alone do not count); decided
from the node, never its class.
candidates
¶
candidates: tuple[SelectorCandidate, ...]
Only from screen_snapshot(selector_candidates=True): every selector that matched only
this node, best first (the first is selector).
showing_hint
¶
showing_hint: bool
The field shows its hint rather than a value (text then holds the hint).
content_invalid
¶
content_invalid: bool
The app marked the node's content invalid, e.g. a field that failed validation.
window_index
¶
window_index: int
One-based window ordinal in this dump, not a persistent window ID; zero if unknown.
window_kind
¶
window_kind: WindowKind
What the node's window is: an app, the keyboard, the status or navigation bar, …
actions
¶
actions: tuple[StandardAction, ...]
The standard actions the node offers that Tap can perform (Element.perform_action).
custom_actions
¶
custom_actions: tuple[str, ...]
The labels of the custom actions the node offers (Element.perform_custom_action).
NodeChange
¶
NodeFlag
¶
Bases: Enum
A boolean property of a node; ScreenNode.flags holds the ones that are true.
SelectorCandidate
¶
One selector that matched only its ScreenNode in the dump, and how it does so.
SelectorKind
¶
Bases: Enum
How a SelectorCandidate singles out its node. PLAIN: one property (resource id,
text, description or hint); COMBINED: two of the node's own properties; ANCESTOR: a
property plus an ancestor it sits under; BY_INDEX: an index pick, right for this dump but
fragile if the screen reorders. UNKNOWN: a kind this client does not know.
EventLog
¶
TapConnection.event_log(): the kept events, oldest first, and how many older ones the
server evicted (it keeps each connection's last 2000).
LoggedEvent
¶
One device call from a connection's event log (TapConnection.event_log()).
The call and its outcome are the server API's own messages in proto3 JSON form with the
.proto field names, so any language's protobuf library can parse them: command is a
tap.v1.Command (for Execute) and app a tap.v1.AppCall (for an app lifecycle call);
exactly one is set. error is the tap.v1.Error the driver returned and failure the
tap.v1.Failure of a call that failed as an RPC; both are None when the call succeeded.
at is when the call started (Unix seconds); duration is in seconds.
Methods:
| Name | Description |
|---|---|
to_dict |
A JSON-ready dict: the fields above with |