halyard.phone. Coordinates and boxes are screen pixels:
the phone’s frame, from the top-left, the space screenshot(), observe() and
tap() all use.
Coords
A point. ATypedDict, so a plain dict works.
| Key | Type |
|---|---|
x | int |
y | int |
BBox
A box from its top-left corner. ATypedDict.
| Key | Type |
|---|---|
x | int |
y | int |
width | int |
height | int |
Screen
One observed frame, fromphone.observe(). A frozen dataclass.
screen.find_text()
The first text region whose text matches: a case-insensitive substring unless exact.
Element | None.
screen.find_all_text()
Every text region that contains contains, or matches the regular expression
pattern. With neither, every region.
list[Element]. Raises ValueError when both are given.
Element
One text region OCR found. Plain data: to act on something, use a locator (phone.get_by_text(...)), which finds it again on the current screen.
IconBox
One detected icon. The icon model finds where icons are, not what they are.DeviceInfo
What the phone is, fromphone.device_info() and the handshake. Size behaviour
from input_modalities and form_factor, not from a platform string.
| Field | Type | Description |
|---|---|---|
device_id | str | The phone’s id. |
platform | str | The OS family, such as "android". |
form_factor | str | The physical class, such as "phone". |
input_modalities | tuple[str, ...] | What it accepts, such as ("touch", "keyboard"). |
model | str | Best effort; empty when unknown. |
os_version | str | Best effort; empty when unknown. |
screen_width, screen_height | int | The frame size in pixels. |
HandshakeResult
TheProtocol.handshake reply, from phone.handshake().
| Field | Type | Description |
|---|---|---|
protocol_version | int | The protocol version the phone speaks. |
device | DeviceInfo | What the phone is. |
domains | tuple[str, ...] | The domains it advertises. |
capabilities | tuple[str, ...] | The exact methods it answers. |
| Method | Returns |
|---|---|
supports(method) | Whether method (such as "Touch.tap") is in capabilities. |
has_domain(domain) | Whether domain (such as "Accessibility") is in domains. |