ADB Actions
ActionsADB shell-based device actions that bypass the accessibility service
Access these methods through agent.actions.adb. These actions use ADB shell commands instead of the accessibility service, providing an alternative when the accessibility service is unavailable or unreliable.
Available since: App version 2.141 (153)
tap()
tap(x: number, y: number): Promise<void>Performs a single tap at the specified screen coordinates using ADB shell input.
Parameters
| Name | Type | Description |
|---|---|---|
x | number | X coordinate on screen |
y | number | Y coordinate on screen |
Returns
Promise<void>Resolves when tap is complete
Examples
await agent.actions.adb.tap(100, 200);hold()
hold(x: number, y: number, duration: number): Promise<void>Performs a long press at the specified coordinates using ADB shell input.
Parameters
| Name | Type | Description |
|---|---|---|
x | number | X coordinate on screen |
y | number | Y coordinate on screen |
duration | number | Hold duration in milliseconds |
Returns
Promise<void>Resolves when hold is complete
Examples
await agent.actions.adb.hold(500, 500, 1000);swipe()
swipe(x1: number, y1: number, x2: number, y2: number, duration: number): Promise<void>Performs a swipe gesture from one point to another using ADB shell input.
Parameters
| Name | Type | Description |
|---|---|---|
x1 | number | Starting X coordinate |
y1 | number | Starting Y coordinate |
x2 | number | Ending X coordinate |
y2 | number | Ending Y coordinate |
duration | number | Duration in milliseconds |
Returns
Promise<void>Resolves when swipe is complete
Examples
await agent.actions.adb.swipe(500, 1500, 500, 500, 300);swipePoly()
swipePoly(startX: number, startY: number, sequence: {x: number, y: number, duration?: number}[], duration: number): Promise<void>Swipes through multiple points sequentially using ADB shell input. Each segment is executed as a separate ADB swipe command. Optionally supports per-segment duration.
Parameters
| Name | Type | Description |
|---|---|---|
startX | number | Starting X coordinate |
startY | number | Starting Y coordinate |
sequence | {x, y, duration?}[] | Array of points to swipe through. Each point can optionally specify its own duration in ms. |
duration | number | Total duration in ms. Divided equally among segments if per-point durations are not specified. Use 0 for default (~500ms total). |
Returns
Promise<void>Resolves when all swipe segments are complete
Examples
await agent.actions.adb.swipePoly(100, 100, [ { x: 100, y: 500 }, { x: 400, y: 500 }], 600);await agent.actions.adb.swipePoly(100, 100, [ { x: 100, y: 500, duration: 200 }, { x: 400, y: 500, duration: 300 }], 0);doubleTap()
doubleTap(x: number, y: number, interval?: number): Promise<void>Performs a double tap at the specified coordinates using ADB shell input.
Parameters
| Name | Type | Description |
|---|---|---|
x | number | X coordinate on screen |
y | number | Y coordinate on screen |
interval? | number | Interval between taps in ms (default: 100) |
Returns
Promise<void>Resolves when double tap is complete
Examples
await agent.actions.adb.doubleTap(500, 500);await agent.actions.adb.doubleTap(500, 500, 200);goHome()
goHome(): Promise<void>Returns to the home screen using ADB keyevent.
Returns
Promise<void>Resolves when navigation is complete
Examples
await agent.actions.adb.goHome();goBack()
goBack(): Promise<void>Presses the system back button using ADB keyevent.
Returns
Promise<void>Resolves when back action is complete
Examples
await agent.actions.adb.goBack();recents()
recents(): Promise<void>Opens the recent apps screen using ADB keyevent.
Returns
Promise<void>Resolves when recent apps screen is shown
Examples
await agent.actions.adb.recents();dpad()
dpad(direction: "up" | "down" | "left" | "right" | "center"): Promise<void>Sends a D-pad navigation event using ADB keyevent.
Parameters
| Name | Type | Description |
|---|---|---|
direction | "up" | "down" | "left" | "right" | "center" | Direction to navigate |
Returns
Promise<void>Resolves when navigation is complete
Examples
await agent.actions.adb.dpad("down");await agent.actions.adb.dpad("center"); // Select/EnterinputKey()
inputKey(keyCode: number, duration?: number): Promise<void>Sends a key input event using ADB keyevent. Supports long press via duration parameter.
Parameters
| Name | Type | Description |
|---|---|---|
keyCode | number | Android KeyEvent code (e.g., 66 for Enter, 67 for Backspace) |
duration? | number | Press duration in ms. 0 for normal press, >0 for long press (default: 0) |
Returns
Promise<void>Resolves when key event is complete
Examples
await agent.actions.adb.inputKey(66);await agent.actions.adb.inputKey(66, 1000);writeText()
writeText(text: string): Promise<void>Types text using ADB shell input. Special characters are automatically escaped.
Parameters
| Name | Type | Description |
|---|---|---|
text | string | Text to type |
Returns
Promise<void>Resolves when text is typed
Examples
await agent.actions.adb.writeText("Hello World");launchApp()
launchApp(packageName: string): Promise<void>Launches an app by its package name using ADB monkey command.
Parameters
| Name | Type | Description |
|---|---|---|
packageName | string | The app's package name (e.g., com.android.chrome) |
Returns
Promise<void>Resolves when app launch command is sent
Examples
await agent.actions.adb.launchApp("com.android.chrome");screenContent()
screenContent(): Promise<AndroidNode>Gets the current screen content (UI hierarchy) via ADB uiautomator dump. Returns the same AndroidNode structure as the regular screenContent() method.
Returns
Promise<AndroidNode>Root node of the accessibility tree
Examples
const screen = await agent.actions.adb.screenContent();const button = screen.findTextOne("Submit");listApps()
listApps(): Promise<string[]>Gets the list of installed package names via ADB pm list packages.
Returns
Promise<string[]>Array of installed package names
Examples
const apps = await agent.actions.adb.listApps();console.log(apps); // ["com.android.chrome", "com.google.android.youtube", ...]screenshot()
screenshot(maxWidth: number, maxHeight: number, quality: number, cropX1?: number, cropY1?: number, cropX2?: number, cropY2?: number): Promise<{...}>Takes a screenshot via ADB screencap. Returns the image as a base64-encoded JPEG string along with dimension metadata.
Parameters
| Name | Type | Description |
|---|---|---|
maxWidth | number | Maximum width to scale down to |
maxHeight | number | Maximum height to scale down to |
quality | number | JPEG quality (1-100) |
cropX1? | number | Crop left coordinate |
cropY1? | number | Crop top coordinate |
cropX2? | number | Crop right coordinate |
cropY2? | number | Crop bottom coordinate |
Returns
Promise<{ screenshot, compressedWidth, compressedHeight, originalWidth, originalHeight }>Screenshot data with base64 image and dimensions
Examples
const result = await agent.actions.adb.screenshot(720, 1280, 80);console.log(result.originalWidth, result.originalHeight);const result = await agent.actions.adb.screenshot(720, 1280, 80, 0, 0, 360, 640);allScreensContent()
allScreensContent(): Promise<AndroidNode[]>Gets the UI hierarchy from all screens/windows via ADB. Returns an array of AndroidNode objects, one per window.
Returns
Promise<AndroidNode[]>Array of root nodes, one per screen/window
Examples
const screens = await agent.actions.adb.allScreensContent();for (const screen of screens) { const buttons = screen.findText("OK"); console.log(buttons.length);}