API reference
getClient(selector)
Get an instance of the Appetize client.
Parameters
Name | Type | Description |
---|---|---|
selector |
| A query selector string pointing to the embedded iframe |
getClient(selector, config)
Get an instance of the Appetize client as well as set the initial config when loading the client.
Useful when the embed link might not be known up front and the configuration has to be applied at runtime.
Parameters
Name | Type | Description |
---|---|---|
selector |
| A query selector string pointing to the embedded iframe |
config |
| A JSON object describing the Configuration options for the device. |
Client
on()
Listens for an event of the given name
Event | Data Type | Description |
---|---|---|
| Your position in queue for the device.
If | |
| An error has occurred | |
| Information about the current device, such as type, osVersion, and screen dimensions. | |
| A new session has been requested either by the client or user clicking "Tap to Play" | |
| An active session has ended. | |
| A new session has started either by the client or user clicking "Tap to Play" | |
app |
| The currently loaded Appetize app |
startSession()
Starts a session with the requested app, device, operating system, and other launch options.
Parameters
Name | Type | Description |
---|---|---|
|
| A JSON object describing the Configuration options for the device. |
setConfig()
Update the configured app, device, operating system, or other launch options.
Note: This will end any active sessions.
Parameters
Name | Type | Description |
---|---|---|
|
| A JSON object describing the Configuration options for the device. |
getConfig()
Returns the current config
endSession()
Ends the active session or cancels any pending session requests.
device
The currently loaded device
app
The currently loaded app
Session
on()
Listens for an event of the given name
Event | Data Type | Description |
---|---|---|
| A user action has been recorded. This can be played back later with playAction.
Requires record to be set to | |
| Audio frames of the current session.
Requires audio to be set to | |
| An error has occurred on the session | |
| Session is about to timeout due to inactivity. Any user interaction or a heartbeat will reset the timeout. | |
| User has interacted with the device. | |
| Debug log from the device
Requires debug to be set to | |
| Intercepted network request or responses. Requires proxy to be set to | |
| The device has changed orientation | |
| ||
| The session has ended |
end()
Ends the session
rotate()
Rotates the device 90 degrees
Parameters
Name | Type | Description |
---|---|---|
direction |
| The direction to rotate |
screenshot(format)
Takes a screenshot of the device and returns the data
Parameters
Name | Type | Description |
---|---|---|
format? |
| The format of the screenshot data to return. Defaults to |
heartbeat()
Sends a heartbeat to the server, resetting the inactivity timer
tap(target, options)
Taps on the screen at the given position, coordinate or element
Parameters
Name | Type | Description |
---|---|---|
target.coordinates? |
| The coordinates in dip units |
target.position? |
| The position on screen in % |
target.element? |
| |
target.duration? |
| Duration of the tap |
options.timeout? |
| If an element is provided, the amount of time to wait for it to appear in ms (defaults 10s) |
options.matchIndex? |
| If multiple elements match the element selector, select the nth one |
swipe(target, options)
Swipes on the screen at the given position, coordinate or element
target.coordinates? |
| The coordinates in dip units to start the swipe |
target.position? |
| The position on screen in % |
target.element? |
| |
target.duration? |
| Duration of the swipe |
target.gesture |
| The gesture of the swipe. See swipe for more details |
options.timeout? |
| If an element is provided, the amount of time to wait for it to appear in ms (defaults 10s) |
options.matchIndex? |
| If multiple elements match the element selector, select the nth one |
type(text)
Types the given text on the device
Parameters
Name | Type | Description |
---|---|---|
text |
| Text to type |
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.
keypress(character, options)
Sends a single key press to the device
Parameters
Name | Type | Description |
---|---|---|
key |
| Key to send to the device ('a', 'b', etc.)
Also takes special values for hardware keys:
|
options.shift? |
|
setLanguage(language)
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
Name | Type | Description |
---|---|---|
language |
| Language code |
setLocation(lat, long)
Sets the simulated location of the device.
Parameters
Name | Type | Description |
---|---|---|
latitude |
| 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 |
| 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. |
openUrl(url)
Opens a deep-link or web URL
Parameters
Name | Type | Description |
---|---|---|
|
| The URL |
shake()
Shakes device
toggleSoftKeyboard()
Toggles the soft keyboard (iOS only)
biometry(match)
Simulate a matching fingerprint (Android 8+ only)
allowInteractions(enabled)
Enables or disables all interactions on the device. Default is true.
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 |
---|---|---|
|
| Android:
The app's package name / appId (e.g., |
restartApp()
Restarts the app
reinstallApp()
Reinstalls the app
getUI()
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.
playAction(action, options)
Play an automation Action or array of Actions.
Parameters
Name | Type | Description |
---|---|---|
action |
| Actions emitted from the |
options.timeout? |
| Amount of time in ms to wait for the action to succeed (default 10s) |
playActions(actions, options)
Plays an array of actions.
Parameters
Name | Type | Description |
---|---|---|
actions |
| Actions emitted from the |
options.timeout? |
| Amount of time in ms to wait for an action to succeed (default 10s) |
waitForAnimations(options)
Waits until the there are no ongoing animations on the screen by waiting for the image to stabilize for at least 1 second.
Parameters
Name | Type | Description |
---|---|---|
options.imageThreshold? |
| 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? |
| The maximum amount of time (in ms) to wait for the image to stabilize. (default 10s) |
adbConnection
Info for connecting to the Android devices via adb. Requires enableAdb to be true
networkInspectorUrl
The URL to chrome dev tools to inspect network logs. Requires proxy to be set to intercept
device
The current device
app
The Appetize app for the session
path
The URL to the Appetizer server
token
The token of the Appetize session
Last updated