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.

setConfig()

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.setConfig(config)

endSession()

Ends the active session or cancels any pending session requests.

await client.endSession()

Session

adbShellCommand()

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

allowInteractions()

Enables or disables all interactions on the device.

biometryEnrollment()

Sets the biometry enrollment status (iOS Only)

biometry()

Simulate a matching fingerprint (Android 8+ only) or Face ID (iOS)

end()

Ends the session

getUI()

Returns an array of elements describing the current UI on the device.

heartbeat()

Sends a heartbeat to the server, resetting the inactivity timer of the session

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)

  • LOCK_SCREEN (Android)

  • UNLOCK_SCREEN (Android)

  • TOGGLE_SCREEN_LOCK (iOS)

openUrl()

Opens a deep-link or web URL

launchApp(appId)

Launches the specified application using the provided appId.

If the app is already running, it will be brought to the foreground instead of being relaunched. If the app was originally launched with params or a launchUrl, these will also be passed with this method.

Parameters

Name
Type
Description

appId

string

Android: The app's package name / appId (e.g., com.example.app) or packageName/activityName. If no activity name is specified, it defaults to the main launch activity. iOS: The app's bundle identifier (e.g., com.example.app).

restartApp()

Restarts the app

reinstallApp()

Reinstalls 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

toggleSoftKeyboard()

Toggles the soft keyboard (iOS only)

setLanguage()

Changes the current language.

type()

Types the given text

addMedia(file)

The maximum file size for uploading media is 50 MB.

Upload media to the device.

Last updated