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
public Map<String, Object> source()
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; 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.
@return the hierarchy under source, with units, scale and redacted
Examples
Save the raw hierarchy
Map<String, Object> source = device.source();
Files.writeString(Path.of("screen.xml"), (String) source.get("source"));