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 IDictionary<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.
Examples
Save the raw hierarchy
var source = device.Source();
File.WriteAllText("screen.xml", (string)source["source"]!);