device_page_source
Get UI hierarchy XML of a device . Bounds are in physical pixel coordinates — use them directly with device_tap/device_swipe (no scaling needed). Supports element filtering by text/class and compact description format. Pass search to grep the dump case-insensitively across text/content-desc/class/resource-id — the fast way to check if a target is present. If it is NOT in the dump it may be scrolled off-screen (Android only dumps rendered nodes): use device_scroll_to_element to bring it in, device_find_element/device_locators_for to resolve a stable locator, or device_wait_for_element to wait out animations.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | Filter: only return elements where text or content-desc matches this string | |
| udid | Yes | Device serial number (UDID) | |
| format | No | Output format: xml (default) or description (compact readable list) | |
| search | No | Case-insensitive substring grepped across the whole node (text, content-desc, class, resource-id). Looser than `text` (which is an exact text=/content-desc= match) — use it to locate an element without knowing its exact label. | |
| className | No | Filter: only return elements matching this class name (e.g. android.widget.Button) |