Device commands

The client provides methods to configure the device and start a session, while the session provides methods for user interaction.

Client

startSession()

Starts a session with the requested app, device, operating system, and other launch options.

const session = await client.startSession()

Parameters

Name
Type
Description

config?

Record<string, any>

A JSON object describing the Configuration options for the device.

config()

Update the configured app, device, operating system, or other launch options. See Configuration for acceptable values.

Note: This will end any active sessions.

await client.config(config)

Session

adbShellCommand

Executes an adb shell command on the device (Android only)

allowInteractions()

Enables or disables all interactions on the device.

biometry()

Simulate a matching fingerprint (Android 8+ only)

end()

Ends the session

getUI()

Returns the UI of the app as an XML string

This returns an XML representation of your app's user interface. You may find it helpful to retrieve this data (UI Dump) to programmatically understand what your app is displaying.

heartbeat()

Sends a heartbeat to the server, resetting the inactivity timer

keypress()

Sends a single key press to the device.

This can also be used to send hardware keys:

  • HOME

  • VOLUME_UP (Android)

  • VOLUME_DOWN (Android)

  • ANDROID_KEYCODE_MENU (Android)

openUrl()

Opens a deep-link or web URL

restartApp()

Restarts the app

rotate()

Rotates the device 90 degrees left or right

screenshot()

Takes a screenshot of the device and returns the data as a buffer.

Alternatively, it can return the data as a base64 encoded string

shake()

Shakes device (iOS only)

setLanguage()

Changes the current language and restarts the app

Last updated