Skip to main content

source

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

The raw hierarchy, as the device-side server sent it: UiAutomator2's or uiautomator's XML on Android, WebDriverAgent's on iOS, and in a WebView context the page's current markup: the page source. These call app_source.

source​

def source() -> dict

The raw hierarchy — the page source — for when map leaves out the thing you need to see. map is what to act on.

source is the platform's XML, or in a WebView the page's markup; format is "xml" or "html"; units is "px" on Android and "pt" on iOS, where map, taps and screenshots are in pixels, scale times as many. redacted counts the password fields hidden.

Examples​

Save the raw hierarchy​

source = device.source()
with open("screen.xml", "w") as f:
print(source["source"], file=f)