Skip to content

Android

Global object. Use it to perform actions not related to a particular object. You do not need to record or learn this object, it is always automatically available in any test.

Action Summary

Action Description
DoFlick Flick action.
DoGoToUrl Opens URL in active browser.
DoPressBack Presses Back button.
DoPressHome Presses Home button.
DoPressKeyCode Presses key with code.
DoPressMenu Presses Menu button.
DoScreenshot Makes screenshot of a device.
DoStartActivity Starts activity.
DoStartVideoRecording Starts video recording on a device.
DoStopVideoRecording Stops video recording on a device.
DoSwipe Swipe action.
DoTap Tap screen.
GetCapability Gets capability with specified name.
GetContext Gets current context.
SetContext Sets context.

Action Detail

DoFlick

Flick action.

Android.DoFlick(endX, endY, startX, startY, touchCount)

Parameters:

Name Type Description
endX number x coordinate where swipe ends (in pixels or relative units)
endY number y coordinate where swipe ends (in pixels or relative units)
startX number x coordinate where swipe begins (in pixels or relative units)
Optional.
startY number y coordinate where swipe begins (in pixels or relative units)
Optional.
touchCount number how many fingers to swipe with
Optional.

Returns:

'true' if successful, 'false' otherwise.

DoGoToUrl

Opens URL in active browser.

Android.DoGoToUrl(url)

Parameters:

Name Type Description
url string

Returns:

'true' if successful, 'false' otherwise.

DoPressBack

Presses Back button.

Android.DoPressBack()

Returns:

'true' if successful, 'false' otherwise.

DoPressHome

Presses Home button.

Android.DoPressHome()

Returns:

'true' if successful, 'false' otherwise.

DoPressKeyCode

Presses key with code.

Android.DoPressKeyCode(keyCode)

Parameters:

Name Type Description
keyCode number Key code: http://developer.android.com/reference/android/view/KeyEvent.html

Returns:

'true' if successful, 'false' otherwise.

DoPressMenu

Presses Menu button.

Android.DoPressMenu()

Returns:

'true' if successful, 'false' otherwise.

DoScreenshot

Makes screenshot of a device.

Android.DoScreenshot(txtLabel)

Parameters:

Name Type Description
txtLabel string Label of a screenshot in the report.
Optional.

Returns:

'true' if successful, 'false' otherwise.

DoStartActivity

Starts activity.

Android.DoStartActivity(appPackage, appActivity)

Parameters:

Name Type Description
appPackage string Package name.
appActivity string Activity name.

Returns:

'true' if successful, 'false' otherwise.

DoStartVideoRecording

Starts video recording on a device.

Android.DoStartVideoRecording()

Returns:

'true' if successful, 'false' otherwise.

DoStopVideoRecording

Stops video recording on a device.

Android.DoStopVideoRecording()

Returns:

'true' if successful, 'false' otherwise.

DoSwipe

Swipe action.

Android.DoSwipe(endX, endY, startX, startY, duration, touchCount)

Parameters:

Name Type Description
endX number x coordinate where swipe ends (in pixels or relative units)
endY number y coordinate where swipe ends (in pixels or relative units)
startX number x coordinate where swipe begins (in pixels or relative units)
Optional.
startY number y coordinate where swipe begins (in pixels or relative units)
Optional.
duration number time (in seconds) to spend performing the swipe/drag
Optional.
touchCount number how many fingers to swipe with
Optional.

Returns:

'true' if successful, 'false' otherwise.

DoTap

Tap screen.

Android.DoTap(x, y, duration, tapCount, touchCount)

Parameters:

Name Type Description
x number x coordinate to tap (in pixels or relative units)
Optional.
y number y coordinate to tap (in pixels or relative units)
Optional.
duration number how long (in seconds) to tap
Optional.
tapCount number how many times to tap
Optional.
touchCount number how many fingers to tap with
Optional.

Returns:

'true' if successful, 'false' otherwise.

GetCapability

Gets capability with specified name.

Android.GetCapability(name)

Parameters:

Name Type Description
name string Name of a capability.

Returns:

Capability string.

GetContext

Gets current context.

Android.GetContext()

Returns:

Either NATIVE_APP or WEBVIEW_1.

SetContext

Sets context.

Android.SetContext(name)

Parameters:

Name Type Description
name string Either NATIVE_APP or WEBVIEW_1.