Documentation
¶
Index ¶
- Constants
- Variables
- func BatteryStatusName(status int) string
- type BackupOptions
- type BatteryInfo
- type CPUInfo
- type Client
- func (c *Client) AdbPath() string
- func (c *Client) Backup(ctx context.Context, serial, outputPath string, options BackupOptions) error
- func (c *Client) Bugreport(ctx context.Context, serial, outputPath string) error
- func (c *Client) Cat(ctx context.Context, serial, path string) (string, error)
- func (c *Client) Chmod(ctx context.Context, serial, path, mode string) error
- func (c *Client) Chown(ctx context.Context, serial, path, owner string) error
- func (c *Client) ClearData(ctx context.Context, serial, pkg string) error
- func (c *Client) CollapseNotifications(ctx context.Context, serial string) error
- func (c *Client) Connect(ctx context.Context, host string) error
- func (c *Client) DeleteSetting(ctx context.Context, serial string, namespace SettingNamespace, key string) error
- func (c *Client) DisablePackage(ctx context.Context, serial, pkg string) error
- func (c *Client) DisableVerity(ctx context.Context, serial string) error
- func (c *Client) DisableWifi(ctx context.Context, serial string) error
- func (c *Client) Disconnect(ctx context.Context, host string) error
- func (c *Client) DiskFree(ctx context.Context, serial string) ([]DiskUsage, error)
- func (c *Client) DumpUIHierarchy(ctx context.Context, serial string) (string, error)
- func (c *Client) Dumpsys(ctx context.Context, serial, service string) (string, error)
- func (c *Client) DumpsysList(ctx context.Context, serial string) ([]string, error)
- func (c *Client) EnablePackage(ctx context.Context, serial, pkg string) error
- func (c *Client) EnableVerity(ctx context.Context, serial string) error
- func (c *Client) EnableWifi(ctx context.Context, serial string) error
- func (c *Client) Exec(ctx context.Context, args ...string) (*ExecResult, error)
- func (c *Client) ExecDevice(ctx context.Context, serial string, args ...string) (*ExecResult, error)
- func (c *Client) ExpandNotifications(ctx context.Context, serial string) error
- func (c *Client) ExpandQuickSettings(ctx context.Context, serial string) error
- func (c *Client) Find(ctx context.Context, serial, path, name string) ([]string, error)
- func (c *Client) FindAndTapElement(ctx context.Context, serial, text, resourceID string, index int) error
- func (c *Client) ForceStop(ctx context.Context, serial, pkg string) error
- func (c *Client) Forward(ctx context.Context, serial, local, remote string) error
- func (c *Client) ForwardList(ctx context.Context, serial string) ([]ForwardRule, error)
- func (c *Client) ForwardRemove(ctx context.Context, serial, local string) error
- func (c *Client) ForwardRemoveAll(ctx context.Context, serial string) error
- func (c *Client) GetAPKPath(ctx context.Context, serial, pkg string) (string, error)
- func (c *Client) GetAirplaneMode(ctx context.Context, serial string) (bool, error)
- func (c *Client) GetAppMemInfo(ctx context.Context, serial, pkg string) (string, error)
- func (c *Client) GetAutoRotation(ctx context.Context, serial string) (bool, error)
- func (c *Client) GetBatteryInfo(ctx context.Context, serial string) (*BatteryInfo, error)
- func (c *Client) GetBrightness(ctx context.Context, serial string) (int, error)
- func (c *Client) GetCPUUsage(ctx context.Context, serial string) (*CPUInfo, error)
- func (c *Client) GetClipboard(ctx context.Context, serial string) (string, error)
- func (c *Client) GetCurrentActivity(ctx context.Context, serial string) (string, error)
- func (c *Client) GetDevice(ctx context.Context, serial string) (*Device, error)
- func (c *Client) GetDeviceInfo(ctx context.Context, serial string) (*DeviceInfo, error)
- func (c *Client) GetDiskUsage(ctx context.Context, serial string) ([]DiskUsage, error)
- func (c *Client) GetDisplayInfo(ctx context.Context, serial string) (*DisplayInfo, error)
- func (c *Client) GetFocusedApp(ctx context.Context, serial string) (string, error)
- func (c *Client) GetFontScale(ctx context.Context, serial string) (float64, error)
- func (c *Client) GetIPAddress(ctx context.Context, serial string) (string, error)
- func (c *Client) GetMemInfo(ctx context.Context, serial string) (*MemInfo, error)
- func (c *Client) GetNetstat(ctx context.Context, serial string) ([]NetConnection, error)
- func (c *Client) GetNetworkInfo(ctx context.Context, serial string) (*NetworkInfo, error)
- func (c *Client) GetPackageInfo(ctx context.Context, serial, pkg string) (*PackageDetail, error)
- func (c *Client) GetProp(ctx context.Context, serial, key string) (string, error)
- func (c *Client) GetSELinuxStatus(ctx context.Context, serial string) (string, error)
- func (c *Client) GetScreenSize(ctx context.Context, serial string) (width, height int, err error)
- func (c *Client) GetSerialNo(ctx context.Context, serial string) (string, error)
- func (c *Client) GetSetting(ctx context.Context, serial string, namespace SettingNamespace, key string) (string, error)
- func (c *Client) GetState(ctx context.Context, serial string) (DeviceState, error)
- func (c *Client) GetTopProcesses(ctx context.Context, serial string, count int) ([]ProcessInfo, error)
- func (c *Client) GetUsageStats(ctx context.Context, serial string) (string, error)
- func (c *Client) GetVolume(ctx context.Context, serial string) (int, error)
- func (c *Client) GetWifiStatus(ctx context.Context, serial string) (bool, error)
- func (c *Client) GetWindowInfo(ctx context.Context, serial string) (string, error)
- func (c *Client) GrantPermission(ctx context.Context, serial, pkg, permission string) error
- func (c *Client) Head(ctx context.Context, serial, path string, lines int) (string, error)
- func (c *Client) HumanSwipe(ctx context.Context, serial string, screenW, screenH int, p GestureParams) error
- func (c *Client) InstallAPK(ctx context.Context, serial, path string, options InstallOptions) error
- func (c *Client) IsRooted(ctx context.Context, serial string) bool
- func (c *Client) IsScreenOn(ctx context.Context, serial string) (bool, error)
- func (c *Client) KeyEvent(ctx context.Context, serial string, keycode int) error
- func (c *Client) KillProcess(ctx context.Context, serial string, pid int) error
- func (c *Client) KillProcessByName(ctx context.Context, serial, name string) error
- func (c *Client) KillServer(ctx context.Context) error
- func (c *Client) ListActivities(ctx context.Context, serial, pkg string) ([]string, error)
- func (c *Client) ListAppPermissions(ctx context.Context, serial, pkg string) ([]PermissionInfo, error)
- func (c *Client) ListDevices(ctx context.Context) ([]*Device, error)
- func (c *Client) ListDir(ctx context.Context, serial, dirPath string) ([]FileInfo, error)
- func (c *Client) ListNotifications(ctx context.Context, serial string) ([]NotificationInfo, error)
- func (c *Client) ListPackages(ctx context.Context, serial string, options ListOptions) ([]PackageInfo, error)
- func (c *Client) ListPermissions(ctx context.Context, serial, group string) ([]string, error)
- func (c *Client) ListProcesses(ctx context.Context, serial string) ([]ProcessInfo, error)
- func (c *Client) ListProps(ctx context.Context, serial string) (map[string]string, error)
- func (c *Client) ListSettings(ctx context.Context, serial string, namespace SettingNamespace) (map[string]string, error)
- func (c *Client) LogcatClear(ctx context.Context, serial string) error
- func (c *Client) LogcatDump(ctx context.Context, serial string, options LogcatOptions) ([]LogEntry, error)
- func (c *Client) LogcatStream(ctx context.Context, serial string, options LogcatOptions) (<-chan LogEntry, error)
- func (c *Client) LongPress(ctx context.Context, serial string, x, y, durationMs int) error
- func (c *Client) MediaNext(ctx context.Context, serial string) error
- func (c *Client) MediaPause(ctx context.Context, serial string) error
- func (c *Client) MediaPlay(ctx context.Context, serial string) error
- func (c *Client) MediaPrev(ctx context.Context, serial string) error
- func (c *Client) Mkdir(ctx context.Context, serial, path string) error
- func (c *Client) OpenURL(ctx context.Context, serial, url string) error
- func (c *Client) Pair(ctx context.Context, host, code string) error
- func (c *Client) Ping(ctx context.Context, serial, host string, count int) (*PingResult, error)
- func (c *Client) Pull(ctx context.Context, serial, remote, local string) error
- func (c *Client) Push(ctx context.Context, serial, local, remote string) error
- func (c *Client) PutSetting(ctx context.Context, serial string, namespace SettingNamespace, ...) error
- func (c *Client) Reboot(ctx context.Context, serial, mode string) error
- func (c *Client) Remount(ctx context.Context, serial string) error
- func (c *Client) Remove(ctx context.Context, serial, path string) error
- func (c *Client) ResetBattery(ctx context.Context, serial string) error
- func (c *Client) ResetDensity(ctx context.Context, serial string) error
- func (c *Client) ResetDisplaySize(ctx context.Context, serial string) error
- func (c *Client) Restore(ctx context.Context, serial, backupPath string) error
- func (c *Client) Reverse(ctx context.Context, serial, remote, local string) error
- func (c *Client) ReverseList(ctx context.Context, serial string) ([]ForwardRule, error)
- func (c *Client) ReverseRemove(ctx context.Context, serial, remote string) error
- func (c *Client) ReverseRemoveAll(ctx context.Context, serial string) error
- func (c *Client) RevokePermission(ctx context.Context, serial, pkg, permission string) error
- func (c *Client) Root(ctx context.Context) error
- func (c *Client) RootDevice(ctx context.Context, serial string) error
- func (c *Client) RunCommand(ctx context.Context, serial, cmd string) (string, error)
- func (c *Client) RunCommandAsRoot(ctx context.Context, serial, cmd string) (string, error)
- func (c *Client) RunInstrumentation(ctx context.Context, serial, component string, options InstrumentOptions) (*ExecResult, error)
- func (c *Client) RunMonkey(ctx context.Context, serial, pkg string, events int, options MonkeyOptions) (*ExecResult, error)
- func (c *Client) ScreenOff(ctx context.Context, serial string) error
- func (c *Client) ScreenOn(ctx context.Context, serial string) error
- func (c *Client) ScreenRecord(ctx context.Context, serial, path string, options ScreenRecordOptions) (*exec.Cmd, error)
- func (c *Client) Screenshot(ctx context.Context, serial, path string) error
- func (c *Client) SendBroadcast(ctx context.Context, serial string, intent Intent) error
- func (c *Client) SetAirplaneMode(ctx context.Context, serial string, enabled bool) error
- func (c *Client) SetAutoRotation(ctx context.Context, serial string, enabled bool) error
- func (c *Client) SetBatteryLevel(ctx context.Context, serial string, level int) error
- func (c *Client) SetBatteryPlugged(ctx context.Context, serial string, plugType int) error
- func (c *Client) SetBatteryStatus(ctx context.Context, serial string, status int) error
- func (c *Client) SetBrightness(ctx context.Context, serial string, level int) error
- func (c *Client) SetClipboard(ctx context.Context, serial string, text string) error
- func (c *Client) SetDensity(ctx context.Context, serial string, dpi int) error
- func (c *Client) SetDisplaySize(ctx context.Context, serial string, w, h int) error
- func (c *Client) SetFontScale(ctx context.Context, serial string, scale float64) error
- func (c *Client) SetProp(ctx context.Context, serial, key, value string) error
- func (c *Client) SetRotation(ctx context.Context, serial string, rotation int) error
- func (c *Client) SetSELinux(ctx context.Context, serial, mode string) error
- func (c *Client) Shell(ctx context.Context, serial string, command string) (*ExecResult, error)
- func (c *Client) ShellArgs(ctx context.Context, serial string, args ...string) (*ExecResult, error)
- func (c *Client) Sideload(ctx context.Context, serial, otaPath string) error
- func (c *Client) SimulateBatteryUnplug(ctx context.Context, serial string) error
- func (c *Client) StartActivity(ctx context.Context, serial string, intent Intent) error
- func (c *Client) StartServer(ctx context.Context) error
- func (c *Client) StartService(ctx context.Context, serial string, intent Intent) error
- func (c *Client) Stat(ctx context.Context, serial, path string) (*FileInfo, error)
- func (c *Client) Swipe(ctx context.Context, serial string, x1, y1, x2, y2, durationMs int) error
- func (c *Client) Tap(ctx context.Context, serial string, x, y int) error
- func (c *Client) TcpIp(ctx context.Context, serial string, port int) error
- func (c *Client) Text(ctx context.Context, serial, text string) error
- func (c *Client) UninstallPackage(ctx context.Context, serial, pkg string, keepData bool) error
- func (c *Client) Unroot(ctx context.Context) error
- func (c *Client) UnrootDevice(ctx context.Context, serial string) error
- func (c *Client) Usb(ctx context.Context, serial string) error
- func (c *Client) Version(ctx context.Context) (string, error)
- func (c *Client) VolumeDown(ctx context.Context, serial string) error
- func (c *Client) VolumeMute(ctx context.Context, serial string) error
- func (c *Client) VolumeUp(ctx context.Context, serial string) error
- func (c *Client) WaitForDevice(ctx context.Context, serial string) error
- func (c *Client) WaitForElement(ctx context.Context, serial, text, resourceID string, timeoutMs int) (*UIElement, error)
- func (c *Client) WriteFile(ctx context.Context, serial, path, content string) error
- type Device
- type DeviceInfo
- type DeviceState
- type DiskUsage
- type DisplayInfo
- type ExecResult
- type FileInfo
- type ForwardRule
- type GestureDef
- type GestureParams
- type InstallOptions
- type InstrumentOptions
- type Intent
- type ListOptions
- type LogEntry
- type LogLevel
- type LogcatOptions
- type MemInfo
- type MonkeyOptions
- type NetConnection
- type NetworkInfo
- type NetworkInterface
- type NotificationInfo
- type PackageDetail
- type PackageInfo
- type PermissionInfo
- type PingResult
- type ProcessInfo
- type Rect
- type ScreenRecordOptions
- type SettingNamespace
- type UIElement
- type UIHierarchy
- type UINode
Constants ¶
const ( KeyHome = 3 KeyBack = 4 KeyCall = 5 KeyEndCall = 6 KeyDPadUp = 19 KeyDPadDown = 20 KeyDPadLeft = 21 KeyDPadRight = 22 KeyDPadCenter = 23 KeyVolumeUp = 24 KeyVolumeDown = 25 KeyPower = 26 KeyCamera = 27 KeyClear = 28 KeyMenu = 82 KeySearch = 84 KeyMediaPlay = 85 KeyMediaStop = 86 KeyMediaNext = 87 KeyMediaPrev = 88 KeyMediaPause = 127 KeyMute = 91 KeyTab = 61 KeyEnter = 66 KeyDelete = 67 KeyRecents = 187 KeyBrightDown = 220 KeyBrightUp = 221 KeySleep = 223 KeyWakeUp = 224 )
Variables ¶
var Gestures = []GestureDef{ {"Swipe Up", GestureParams{0.50, 0.75, 0.50, 0.25, 300}}, {"Swipe Down", GestureParams{0.50, 0.25, 0.50, 0.75, 300}}, {"Swipe Left", GestureParams{0.75, 0.50, 0.25, 0.50, 300}}, {"Swipe Right", GestureParams{0.25, 0.50, 0.75, 0.50, 300}}, {"Scroll Up", GestureParams{0.50, 0.60, 0.50, 0.40, 200}}, {"Scroll Down", GestureParams{0.50, 0.40, 0.50, 0.60, 200}}, {"Fling Up", GestureParams{0.50, 0.80, 0.50, 0.20, 80}}, {"Fling Down", GestureParams{0.50, 0.20, 0.50, 0.80, 80}}, {"Pull Down", GestureParams{0.50, 0.02, 0.50, 0.60, 300}}, {"Pull Up", GestureParams{0.50, 0.98, 0.50, 0.40, 300}}, }
Gestures is the list of predefined gesture presets.
Functions ¶
func BatteryStatusName ¶
Types ¶
type BackupOptions ¶
type BatteryInfo ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithPath ¶
func (*Client) CollapseNotifications ¶
CollapseNotifications closes the notification shade.
func (*Client) DeleteSetting ¶
func (*Client) DisablePackage ¶
func (*Client) DisableVerity ¶
func (*Client) DumpUIHierarchy ¶
DumpUIHierarchy captures the current UI hierarchy as XML.
func (*Client) DumpsysList ¶
func (*Client) EnablePackage ¶
func (*Client) EnableVerity ¶
func (*Client) ExecDevice ¶
func (*Client) ExpandNotifications ¶
ExpandNotifications pulls down the notification shade.
func (*Client) ExpandQuickSettings ¶
ExpandQuickSettings pulls down the quick settings panel.
func (*Client) FindAndTapElement ¶
func (c *Client) FindAndTapElement(ctx context.Context, serial, text, resourceID string, index int) error
FindAndTapElement dumps the UI, finds an element by text or resource ID, and taps it. The index parameter selects which match to tap when multiple elements match (0-based).
func (*Client) ForwardList ¶
func (*Client) ForwardRemove ¶
func (*Client) ForwardRemoveAll ¶
func (*Client) GetAPKPath ¶
func (*Client) GetAirplaneMode ¶
GetAirplaneMode returns whether airplane mode is enabled.
func (*Client) GetAppMemInfo ¶
func (*Client) GetAutoRotation ¶
GetAutoRotation returns whether auto-rotation is enabled.
func (*Client) GetBatteryInfo ¶
func (*Client) GetBrightness ¶
GetBrightness returns the current screen brightness (0-255).
func (*Client) GetCPUUsage ¶
func (*Client) GetClipboard ¶
func (*Client) GetCurrentActivity ¶
func (*Client) GetDeviceInfo ¶
func (*Client) GetDiskUsage ¶
func (*Client) GetDisplayInfo ¶
func (*Client) GetFocusedApp ¶
GetFocusedApp returns the package name of the currently focused application.
func (*Client) GetFontScale ¶
func (*Client) GetIPAddress ¶
func (*Client) GetMemInfo ¶
func (*Client) GetNetstat ¶
func (*Client) GetNetworkInfo ¶
func (*Client) GetPackageInfo ¶
func (*Client) GetSELinuxStatus ¶
func (*Client) GetScreenSize ¶
func (*Client) GetSerialNo ¶
func (*Client) GetSetting ¶
func (*Client) GetTopProcesses ¶
func (*Client) GetUsageStats ¶
func (*Client) GetWifiStatus ¶
func (*Client) GetWindowInfo ¶
func (*Client) GrantPermission ¶
func (*Client) HumanSwipe ¶
func (c *Client) HumanSwipe(ctx context.Context, serial string, screenW, screenH int, p GestureParams) error
HumanSwipe performs a swipe gesture with small random perturbations to simulate natural human touch behavior. Adds ±10px endpoint jitter and ±5px perpendicular drift so the path is never a perfect straight line.
func (*Client) InstallAPK ¶
func (*Client) IsScreenOn ¶
IsScreenOn checks whether the device screen is currently on.
func (*Client) KillProcess ¶
func (*Client) KillProcessByName ¶
func (*Client) ListActivities ¶
func (*Client) ListAppPermissions ¶
func (*Client) ListNotifications ¶
func (*Client) ListPackages ¶
func (c *Client) ListPackages(ctx context.Context, serial string, options ListOptions) ([]PackageInfo, error)
func (*Client) ListPermissions ¶
func (*Client) ListProcesses ¶
func (*Client) ListSettings ¶
func (*Client) LogcatDump ¶
func (*Client) LogcatStream ¶
func (*Client) MediaPause ¶
MediaPause sends the media pause key event.
func (*Client) PutSetting ¶
func (*Client) ResetBattery ¶
func (*Client) ResetDensity ¶
func (*Client) ResetDisplaySize ¶
func (*Client) ReverseList ¶
func (*Client) ReverseRemove ¶
func (*Client) ReverseRemoveAll ¶
func (*Client) RevokePermission ¶
func (*Client) RunCommand ¶
func (*Client) RunCommandAsRoot ¶
func (*Client) RunInstrumentation ¶
func (c *Client) RunInstrumentation(ctx context.Context, serial, component string, options InstrumentOptions) (*ExecResult, error)
func (*Client) RunMonkey ¶
func (c *Client) RunMonkey(ctx context.Context, serial, pkg string, events int, options MonkeyOptions) (*ExecResult, error)
func (*Client) ScreenRecord ¶
func (*Client) Screenshot ¶
func (*Client) SendBroadcast ¶
func (*Client) SetAirplaneMode ¶
SetAirplaneMode enables or disables airplane mode.
func (*Client) SetAutoRotation ¶
SetAutoRotation enables or disables auto-rotation.
func (*Client) SetBatteryLevel ¶
func (*Client) SetBatteryPlugged ¶
func (*Client) SetBatteryStatus ¶
func (*Client) SetBrightness ¶
SetBrightness sets the screen brightness (0-255).
func (*Client) SetClipboard ¶
func (*Client) SetDensity ¶
func (*Client) SetDisplaySize ¶
func (*Client) SetFontScale ¶
func (*Client) SetRotation ¶
SetRotation sets the screen rotation. Values: 0=natural, 1=90°, 2=180°, 3=270°.
func (*Client) SetSELinux ¶
func (*Client) SimulateBatteryUnplug ¶
func (*Client) StartActivity ¶
func (*Client) StartService ¶
func (*Client) UninstallPackage ¶
func (*Client) UnrootDevice ¶
func (*Client) VolumeDown ¶
VolumeDown decreases the media volume by one step.
func (*Client) VolumeMute ¶
VolumeMute toggles the mute state.
func (*Client) WaitForDevice ¶
type DeviceInfo ¶
type DeviceInfo struct {
AndroidVersion string
SDKVersion string
BuildNumber string
Brand string
Manufacturer string
Model string
Product string
Hardware string
Serial string
ABIs []string
DisplaySize string
DisplayDensity string
IPAddress string
MacAddress string
BatteryLevel string
BatteryStatus string
TotalRAM string
AvailableRAM string
TotalStorage string
AvailableStorage string
Uptime string
CPUInfo string
}
type DeviceState ¶
type DeviceState string
const ( StateDevice DeviceState = "device" StateOffline DeviceState = "offline" StateNoDevice DeviceState = "no device" )
type ForwardRule ¶
type GestureDef ¶
type GestureDef struct {
Name string
Params GestureParams
}
GestureDef is a named gesture preset.
type GestureParams ¶
type GestureParams struct {
StartXFrac, StartYFrac float64
EndXFrac, EndYFrac float64
DurationMs int
}
GestureParams defines a swipe gesture using fractional screen coordinates (0.0–1.0).
type InstallOptions ¶
type InstrumentOptions ¶
type Intent ¶
type ListOptions ¶
type LogcatOptions ¶
type MonkeyOptions ¶
type NetConnection ¶
type NetworkInfo ¶
type NetworkInfo struct {
Interfaces []NetworkInterface
}
type NetworkInterface ¶
type NotificationInfo ¶
type PackageDetail ¶
type PackageInfo ¶
type PermissionInfo ¶
type PingResult ¶
type ProcessInfo ¶
type Rect ¶
type Rect struct {
Left, Top, Right, Bottom int
}
Rect holds parsed bounds.
func ParseBounds ¶
ParseBounds parses a bounds string like "[0,0][1080,1920]".
type ScreenRecordOptions ¶
type SettingNamespace ¶
type SettingNamespace string
const ( NamespaceSystem SettingNamespace = "system" NamespaceSecure SettingNamespace = "secure" NamespaceGlobal SettingNamespace = "global" )
type UIElement ¶
type UIElement struct {
Text string `json:"text,omitempty"`
ResourceID string `json:"resource_id,omitempty"`
Class string `json:"class,omitempty"`
Package string `json:"package,omitempty"`
ContentDescription string `json:"content_desc,omitempty"`
Clickable bool `json:"clickable"`
Enabled bool `json:"enabled"`
Checked bool `json:"checked"`
Focused bool `json:"focused"`
Selected bool `json:"selected"`
Scrollable bool `json:"scrollable"`
Bounds Rect `json:"bounds"`
}
UIElement is a flattened representation of a UI node with its bounds.
func FindElements ¶
FindElements searches the UI hierarchy for elements matching the given criteria. Matching is case-insensitive substring for text and content_desc, exact match for resource_id. Results are sorted by position (top-to-bottom, then left-to-right) for stable indexing.
func FlattenNodes ¶
FlattenNodes walks the UI tree and returns all nodes as a flat list.
type UIHierarchy ¶
type UIHierarchy struct {
XMLName xml.Name `xml:"hierarchy"`
Rotation int `xml:"rotation,attr"`
Nodes []UINode `xml:"node"`
}
UIHierarchy is the root of a uiautomator dump.
func ParseUIHierarchy ¶
func ParseUIHierarchy(xmlData string) (*UIHierarchy, error)
ParseUIHierarchy parses XML from uiautomator dump into a structured tree.
type UINode ¶
type UINode struct {
Index int `xml:"index,attr"`
Text string `xml:"text,attr"`
ResourceID string `xml:"resource-id,attr"`
Class string `xml:"class,attr"`
Package string `xml:"package,attr"`
ContentDescription string `xml:"content-desc,attr"`
Checkable bool `xml:"checkable,attr"`
Checked bool `xml:"checked,attr"`
Clickable bool `xml:"clickable,attr"`
Enabled bool `xml:"enabled,attr"`
Focusable bool `xml:"focusable,attr"`
Focused bool `xml:"focused,attr"`
Scrollable bool `xml:"scrollable,attr"`
LongClickable bool `xml:"long-clickable,attr"`
Password bool `xml:"password,attr"`
Selected bool `xml:"selected,attr"`
Bounds string `xml:"bounds,attr"`
Children []UINode `xml:"node"`
}
UINode represents a single node in the Android UI hierarchy.