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
func (d *Device) Source(ctx context.Context) (PageSource, error)
Source returns the raw hierarchy — the page source — for when Map leaves out the thing you need to see. Map is what to act on.
Examples
Save the raw hierarchy
src, err := dev.Source(ctx)
if err != nil {
return err
}
if err := os.WriteFile("screen.xml", []byte(src.Source), 0o644); err != nil {
return err
}