Appium
shake
Perform a shake action on the device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.shake()
Support
lock
Lock the device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.lock(seconds)
Parameters
Param | Type | Details |
---|---|---|
seconds optional | number | how long to lock the screen (iOS only) |
Support
unlock
Unlock the device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.unlock()
Support
isLocked
Check whether the device is locked or not.
Appium command. More details can be found in the official protocol docs.
Usage
browser.isLocked()
Support
startRecordingScreen
Start recording the screen.
Appium command. More details can be found in the official protocol docs.
Usage
browser.startRecordingScreen(filePath, videoSize, timeLimit, bitRate)
Parameters
Param | Type | Details |
---|---|---|
filePath | string | path to save video file |
videoSize | number | max amount of bytes the video file should get |
timeLimit | number | max time length of video |
bitRate | number | bit rate of video |
Support
stopRecordingScreen
Stop recording screen
Appium command. More details can be found in the official protocol docs.
Usage
browser.stopRecordingScreen()
Support
getPerformanceDataTypes
Returns the information types of the system state which is supported to read as like cpu, memory, network traffic, and battery.
Appium command. More details can be found in the official protocol docs.
Usage
browser.getPerformanceDataTypes()
Support
getPerformanceDataTypes
Returns the information of the system state which is supported to read as like cpu, memory, network traffic, and battery.
Appium command. More details can be found in the official protocol docs.
Usage
browser.getPerformanceDataTypes(packageName, dataType, dataReadTimeout)
Parameters
Param | Type | Details |
---|---|---|
packageName | string | the package name of the application |
dataType | string | the type of system state which wants to read. It should be one of the supported performance data types |
dataReadTimeout optional | number | the number of attempts to read |
Support
pressKeyCode
Press a particular key on the device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.pressKeyCode(keycode, metastate)
Parameters
Param | Type | Details |
---|---|---|
keycode | string | keycode to press |
metastate optional | string | meta state to press the keycode with |
Support
longPressKeyCode
Press and hold a particular key code on the device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.longPressKeyCode(keycode, metastate)
Parameters
Param | Type | Details |
---|---|---|
keycode | string | keycode to press on the device |
metastate optional | string | metastate for the keypress |
Support
sendKeyEvent
Send a key code to the device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.sendKeyEvent(keycode, metastate)
Parameters
Param | Type | Details |
---|---|---|
keycode | string | keycode to press |
metastate optional | string | meta state to press the keycode with |
getPerformanceDataTypes
Rotate the device in three dimensions.
Appium command. More details can be found in the official protocol docs.
Usage
browser.getPerformanceDataTypes(x, y, radius, rotation, touchCount, duration, element)
Parameters
Param | Type | Details |
---|---|---|
x optional | number | x offset to use for the center of the rotate gesture |
y optional | number | y offset to use for the center of the rotate gesture |
radius optional | number | the distance in points from the center to the edge of the circular path |
rotation optional | number | the length of rotation in radians |
touchCount optional | number | the number of touches to use in the specified gesture |
duration optional | number | the length of hold time for the specified gesture, in seconds |
element optional | string | the id of an element returned in a previous call to execute the rotation on |
Support
getCurrentActivity
Get the name of the current Android activity.
Appium command. More details can be found in the official protocol docs.
Usage
browser.getCurrentActivity()
Support
getCurrentPackage
Get the name of the current Android package.
Appium command. More details can be found in the official protocol docs.
Usage
browser.getCurrentPackage()
Support
installApp
Install the given app onto the device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.installApp(appPath)
Parameters
Param | Type | Details |
---|---|---|
appPath | string | path to application .apk file |
Support
removeApp
Remove an app from the device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.removeApp(appId, bundleId)
Parameters
Param | Type | Details |
---|---|---|
appId | string[] | id of applications to remove |
bundleId optional | string[] | id of bundles to remove |
Support
isAppInstalled
Check whether the specified app is installed on the device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.isAppInstalled(bundleId)
Parameters
Param | Type | Details |
---|---|---|
bundleId | string | id of bundle to check if installed |
Support
hideKeyboard
Hide soft keyboard.
Appium command. More details can be found in the official protocol docs.
Usage
browser.hideKeyboard(strategy, key, keyCode, keyName)
Parameters
Param | Type | Details |
---|---|---|
strategy optional | string | hide keyboard strategy (UIAutomation only), available strategies - 'press', 'pressKey', 'swipeDown', 'tapOut', 'tapOutside', 'default' |
key optional | string | key value if strategy is 'pressKey' |
keyCode optional | string | key code if strategy is 'pressKey' |
keyName optional | string | key name if strategy is 'pressKey' |
Support
isKeyboardShown
Whether or not the soft keyboard is shown.
Appium command. More details can be found in the official protocol docs.
Usage
browser.isKeyboardShown()
Support
pushFile
Place a file onto the device in a particular place.
Appium command. More details can be found in the official protocol docs.
Usage
browser.pushFile(path, data)
Parameters
Param | Type | Details |
---|---|---|
path | string | path to install the data to |
data | string | contents of file in base64 |
Support
pullFile
Retrieve a file from the device's file system.
Appium command. More details can be found in the official protocol docs.
Usage
browser.pullFile(path)
Parameters
Param | Type | Details |
---|---|---|
path | string | path on the device to pull file from |
Support
pullFolder
Retrieve a folder from the device's file system.
Appium command. More details can be found in the official protocol docs.
Usage
browser.pullFolder(path)
Parameters
Param | Type | Details |
---|---|---|
path | string | path to an entire folder on the device |
Support
toggleFlightMode
Toggle airplane mode on device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.toggleFlightMode()
Support
toggleData
Switch the state of data service.
Appium command. More details can be found in the official protocol docs.
Usage
browser.toggleData()
Support
toggleWiFi
Switch the state of the wifi service.
Appium command. More details can be found in the official protocol docs.
Usage
browser.toggleWiFi()
Support
toggleLocationServices
Switch the state of the location service.
Appium command. More details can be found in the official protocol docs.
Usage
browser.toggleLocationServices()
Support
openNotifications
Open Android notifications (Emulator only).
Appium command. More details can be found in the official protocol docs.
Usage
browser.openNotifications()
Support
startActivity
Start an Android activity by providing package name and activity name.
Appium command. More details can be found in the official protocol docs.
Usage
browser.startActivity(appPackage, appActivity, appWaitPackage, appWaitActivity, intentAction, intentCategory, intentFlags, optionalIntentArguments, dontStopAppOnReset)
Parameters
Param | Type | Details |
---|---|---|
appPackage | string | name of app |
appActivity | string | name of activity |
appWaitPackage optional | string | name of app to wait for |
appWaitActivity optional | string | name of activity to wait for |
intentAction optional | string | intent action which will be used to start activity |
intentCategory optional | string | intent category which will be used to start activity |
intentFlags optional | string | flags that will be used to start activity |
optionalIntentArguments optional | string | additional intent arguments that will be used to start activity |
dontStopAppOnReset optional | string | doesn’t stop the process of the app under test, before starting the app using adb |
Support
getSystemBars
Retrieve visibility and bounds information of the status and navigation bars.
Appium command. More details can be found in the official protocol docs.
Usage
browser.getSystemBars()
Support
getDeviceTime
Get the time on the device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.getDeviceTime()
Support
getDisplayDensity
Get display density from device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.getDisplayDensity()
Support
touchId
Simulate a touch id event (iOS Simulator only). To enable this feature, the allowTouchIdEnroll
desired capability must be set to true and the Simulator must be enrolled. When you set allowTouchIdEnroll to true, it will set the Simulator to be enrolled by default. The enrollment state can be toggled. This call will only work if Appium process or its parent application (e.g. Terminal.app or Appium.app) has access to Mac OS accessibility in System Preferences > Security & Privacy > Privacy > Accessibility list.
Appium command. More details can be found in the official protocol docs.
Usage
browser.touchId(match)
Parameters
Param | Type | Details |
---|---|---|
match | boolean | are we simulating a successful touch (true) or a failed touch (false) |
Support
toggleEnrollTouchId
Toggle the simulator being enrolled to accept touchId (iOS Simulator only). To enable this feature, the allowTouchIdEnroll
desired capability must be set to true. When allowTouchIdEnroll
is set to true the Simulator will be enrolled by default, and the 'Toggle Touch ID Enrollment' changes the enrollment state. This call will only work if the Appium process or its parent application (e.g., Terminal.app or Appium.app) has access to Mac OS accessibility in System Preferences > Security & Privacy > Privacy > Accessibility list.
Appium command. More details can be found in the official protocol docs.
Usage
browser.toggleEnrollTouchId(enabled)
Parameters
Param | Type | Details |
---|---|---|
enabled optional | boolean | equals to true if TouchID enrollment should be enabled |
Support
launchApp
Launch an app on device. iOS tests with XCUITest can also use the mobile: launchApp
method. See detailed documentation.
Appium command. More details can be found in the official protocol docs.
Usage
browser.launchApp()
Support
closeApp
Close an app on device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.closeApp()
Support
reset
Reset the currently running app for this session.
Appium command. More details can be found in the official protocol docs.
Usage
browser.reset()
Support
background
Send the currently running app for this session to the background. iOS tests with XCUITest can also use the mobile: terminateApp
method to terminate the current app (see detailed documentation), and the mobile: activateApp
to activate an existing application on the device under test and moves it to the foreground (see detailed documentation).
Appium command. More details can be found in the official protocol docs.
Usage
browser.background(duration)
Parameters
Param | Type | Details |
---|---|---|
duration optional | number | timeout to restore app, if 'null' app won't be restored |
Support
endCoverage
Get test coverage data.
Appium command. More details can be found in the official protocol docs.
Usage
browser.endCoverage(intent, path)
Parameters
Param | Type | Details |
---|---|---|
intent | string | intent to broadcast |
path | string | path to .ec file |
Support
getStrings
Get app strings.
Appium command. More details can be found in the official protocol docs.
Usage
browser.getStrings(language, stringFile)
Parameters
Param | Type | Details |
---|---|---|
language optional | string | language code |
stringFile optional | string | path to the string file |
Support
setValueImmediate
Appium command. More details can be found in the official protocol docs.
Usage
browser.setValueImmediate(elementId, value)
Parameters
Param | Type | Details |
---|---|---|
elementId | String | the id of an element returned in a previous call to Find Element(s) |
value | string | value to set on element |
Support
replaceValue
Replace the value to element directly.
Appium command. More details can be found in the official protocol docs.
Usage
browser.replaceValue(elementId, value)
Parameters
Param | Type | Details |
---|---|---|
elementId | String | the id of an element returned in a previous call to Find Element(s) |
value | string | value to replace on element |
Support
getSettings
Retrieve the current settings on the device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.getSettings()
Support
updateSettings
Update the current setting on the device.
Appium command. More details can be found in the official protocol docs.
Usage
browser.updateSettings(settings)
Parameters
Param | Type | Details |
---|---|---|
settings | object | key/value object with settings to update |
Support
receiveAsyncResponse
Callback url for asynchronous execution of JavaScript.
Appium command. More details can be found in the official protocol docs.
Usage
browser.receiveAsyncResponse(response)
Parameters
Param | Type | Details |
---|---|---|
response | object | response to receive on device |
gsmCall
Make GSM call (Emulator only).
Appium command. More details can be found in the official protocol docs.
Usage
browser.gsmCall(phoneNumber, action)
Parameters
Param | Type | Details |
---|---|---|
phoneNumber | string | the phone number to call to |
action | string | The action - 'call', 'accept', 'cancel', 'hold' |
Support
gsmSignal
Set GSM signal strength (Emulator only).
Appium command. More details can be found in the official protocol docs.
Usage
browser.gsmSignal(signalStrengh)
Parameters
Param | Type | Details |
---|---|---|
signalStrengh | string | signal strength in the range [0, 4] |
Support
sendSms
Simulate an SMS message (Emulator only).
Appium command. More details can be found in the official protocol docs.
Usage
browser.sendSms(phoneNumber, message)
Parameters
Param | Type | Details |
---|---|---|
phoneNumber | string | the phone number to send the SMS too |
message | string | the SMS message |