Session
The Session in Appetize makes it easy to manage and interact with device sessions, including simulating user actions, toggling device states, retrieving device information and more.
Last updated
The Session in Appetize makes it easy to manage and interact with device sessions, including simulating user actions, toggling device states, retrieving device information and more.
Last updated
Listens for an event of the given name
Event | Data Type | Description |
---|---|---|
Ends the session
Rotates the device 90 degrees
Parameters
Takes a screenshot of the device and returns the data
Parameters
Sends a heartbeat to the server, resetting the inactivity timer
Taps on the screen at the given position, coordinate or element
Parameters
Swipes on the screen at the given position, coordinate or element
Types the given text on the device
Parameters
Typing is limited to 1000 characters at a time to ensure optimal performance and prevent potential disruptions. For larger payloads, you can use multiple 'type' operations.
Sends a single key press to the device
Parameters
Changes the current language and restarts the app
If your app does not automatically handle language/locale changes, you would need to explicitly call restartApp for this to take effect. Some apps might also cache data in the previously used language. In these cases use reinstallApp to clear any previous cached data.
Parameters
Sets the simulated location of the device.
Opens a deep-link or web URL
Parameters
Shakes device
Toggles the soft keyboard (iOS only)
Sets the biometry enrollment status (iOS Only)
Simulate a matching fingerprint (Android 8+ only) or Face ID (iOS)
Enables or disables all interactions on the device. Default is true.
Executes an adb shell
command on the device (Android only)
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
Restarts the app
Reinstalls the app
Returns the UI as an XML string
Experimental The data structure of the response is subject to change
Returns an array of elements describing the current UI on the device.
The maximum file size for uploading media is 50 MB.
Upload media to the device.
Returns an element that matches the selector. See Targeting Elements.
This is useful for waiting until an element appears.
If multiple elements are found it will return the first element.
Returns an array of all elements matching that selector. See Targeting Elements.
Play an automation Action or array of Actions.
Parameters
Plays an array of actions.
Parameters
Waits until the there are no ongoing animations on the screen by waiting for the image to stabilize for at least 1 second.
Parameters
Waits for an event to occur
Parameters
Waits for the given time to elapse (in ms)
Parameters
Waits until the session is fully initialised and ready for use.
Info for connecting to the Android devices via adb. Requires enableAdb to be true.
See AdbConnectionInfo.
The Appetize app for the session, if applicable.
See AppetizeApp.
The config applied to the current session.
See SessionConfig.
The current device. See DeviceInfo.
The URL to chrome dev tools to inspect network logs. Requires proxy to be set to intercept
.
The URL to the Appetizer server.
The token of the Appetize session.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
action
A user action has been recorded. This can be played back later with playAction.
Requires record to be set to true
void
App launch event occurred.
audio
{
buffer: Uint8Array, codec: 'aac',
duration: number
}
Audio frames of the current session.
Requires audio to be set to true
error
{ message: string }
An error has occurred on the session
void
First video frame received.
inactivityWarning
{ secondsRemaining: number }
Session is about to timeout due to inactivity.
Any user interaction or a heartbeat will reset the timeout.
interaction
User has interacted with the device.
log
{ message: string }
Debug log from the device
Requires debug to be set to true
network
Intercepted network request or responses.
Requires proxy to be set to intercept
orientationChanged
'portrait' | 'landscape'
The device has changed orientation
video
{
buffer: Uint8Array,
width: number,
height: number,
codec: string
}
end
void
The session has ended
direction
"left" | "right"
The direction to rotate
format?
"buffer" | "base64"
The format of the screenshot data to return. Defaults to buffer
target.coordinates?
{
x: number
y: number
}
The coordinates in dip units
target.position?
{
x: string
y: string
}
The position on screen in %
target.element?
ElementSelector
target.duration?
number
Duration of the tap
options.timeout?
number
If an element is provided, the amount of time to wait for it to appear in ms (defaults 10s)
options.matchIndex?
number
If multiple elements match the element selector, select the nth one
target.coordinates?
{
x: number
y: number
}
The coordinates in dip units to start the swipe
target.position?
{
x: string
y: string
}
The position on screen in %
target.element?
ElementSelector
target.duration?
number
Duration of the swipe
target.gesture
string | function
The gesture of the swipe. See swipe for more details
options.timeout?
number
If an element is provided, the amount of time to wait for it to appear in ms (defaults 10s)
options.matchIndex?
number
If multiple elements match the element selector, select the nth one
text
string
Text to type
key
string
Key to send to the device ('a', 'b', etc.)
Also takes special values for hardware keys:
HOME
Android Only:
VOLUME_UP
VOLUME_DOWN
ANDROID_KEYCODE_MENU
LOCK_SCREEN
UNLOCK_SCREEN
iOS Only:
TOGGLE_SCREEN_LOCK
options.shift?
boolean
language
string
Language code
latitude
number
Decimal number between -90 and 90, representing the degrees of north or south of the Equator. Negative numbers indicate south of the Equator, and positive numbers indicate north of the Equator.
longitude
number
Decimal number between -180 and 180, representing the degrees of east or west of the Prime Meridian. Negative numbers indicate west of the Prime Meridian, and positive numbers indicate east of the Prime Meridian.
url
string
The URL
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
).
action
Record<string, any>
Actions emitted from the session.on('action')
event
options.timeout?
number
Amount of time in ms to wait for the action to succeed (default 10s)
actions
Array<Record<string, any>>
Actions emitted from the session.on('action')
event
options.timeout?
number
Amount of time in ms to wait for an action to succeed (default 10s)
options.imageThreshold?
number
The threshold for the amount of pixels (in %) that can change between frames before the image is considered to be stable. (default 0.001)
options.timeout?
number
The maximum amount of time (in ms) to wait for the image to stabilize. (default 10s)
event
string
One of the session events.
options.timeout?
number | null
The maximum time (in milliseconds) to wait for the event to be emitted.
options.predicate?
(data: T) => boolean
The predicate condition to be satisfied, otherwise the function will continue to wait for the event.
timeout
number
Timeout in milliseconds.