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
source(): Promise<Data>
Examples
Save the raw hierarchy
import { writeFileSync } from 'node:fs'
const { source } = await device.source()
writeFileSync('screen.xml', String(source))