-
Notifications
You must be signed in to change notification settings - Fork 0
RESTful API
The generic format for the response is
{ "status": "OK", ...}
The generic format for the error response is
{ "status": "ERROR", "statusCode": n, "msg": "Error message", ...}
Invokes the main culebra UI.
Shows some help about the basic commands. Help can also be obtained from the UI.
Gets the Android asset specified by the path that follows.
For example:
/Assets/path/to/file.txt
Gets the CulebraTester info.
For example the response is:
{ "status": "OK", "versionName": "0.8.10", "versionCode": 8010, "instrumentation": true }
parameter | description | example |
---|---|---|
format | Output format |
format=markdown
|
escape | Escape HTML |
escape=yes
|
Example output
Culebra Tester: Debug Info Helper Key | Value ----|------ Device|hammerhead Brand|Android Board|hammerhead Hardware|LGE Model|AOSP on HammerHead API|23 Build|hammerhead MASTER
Gets the device art.
parameter | description | example |
---|---|---|
model | The device model |
model=nexus_4
|
Gets some information about the real size of the device display and other useful information.
For example the response is:
{ "device": "mako", "x": 768, "y": 1280, "artWidth": 428, "artHeight": 830, "screenshotWidth": 384, "screenshotX": 21, "screenshotY": 93 }
Gets the object corresponding to the OID.
parameter | description | example |
---|---|---|
oid | object ID |
oid=123
|
Example output:
{"oid":1,"object":"{ \"uis\":\"android.support.test.uiautomator.UiScrollable@f102e21\",\"selector\":\"new UiSelector().resourceId(\"com.android.launcher3:id/apps_list_view\").packageName(\"com.android.launcher3\")\" }","class":"com.dtmilano.android.uiautomatorhelper.UiScrollableBundle"}
List the objects.
Example output:
[{"oid":1,"object":"com.dtmilano.android.uiautomatorhelper.UiObject2Bundle@5198cf7"}, {"oid":2,"object":"com.dtmilano.android.uiautomatorhelper.UiObject2Bundle@2de7764"}, {"oid":3,"object":"com.dtmilano.android.uiautomatorhelper.UiObject2Bundle@c717dcd"}, {"oid":4,"object":"com.dtmilano.android.uiautomatorhelper.UiObject2Bundle@a353682"}]
Quits the Instrumentation and Service.
action | description |
---|---|
getState | Gets recording state |
save | Saves the recording |
setLanguage | Sets recording language to one of Python,Java,Javascript or Groovy |
start | Starts recording |
stop | Stops recording |
Clicks at the specified position.
parameter | description | example |
---|---|---|
x | x |
x=100
|
y | y |
y=100
|
Clicks on the specified object. The target object should have been found using RESTful-API#findObject.
parameter | description | example |
---|---|---|
oid | the OID |
oid=100
|
Dumps the window hierarchy. If format is not specified the dump is XML.
parameter | description | example |
---|---|---|
format | the dump format |
format=JSON
|
This is an example of a JSON dump
{"id":"hierarchy","text":"Window Hierarchy","children":[{"id":0,"resourceId":"","contentDescription":"","text":"android.widget.LinearLayout__","bounds":[0,1184,768,1280],"children":[{"id":1,"resourceId":"com.android.systemui:id/rot0","contentDescription":"","text":"android.widget.FrameLayout_com.android.systemui:id/rot0_","bounds":[0,1184,768,1280],"children":[{"id":2,"resourceId":"com.android.systemui:id/deadzone","contentDescription":"","text":"android.view.View_com.android.systemui:id/deadzone_","bounds":[0,1184,768,1280],"children":[]}
Finds an object. The object found, if any, can be later used in other call like RESTful-API#click.
parameter | description | example |
---|---|---|
resourceId | the resource id |
resourceId=com.android.calendar:id/d0_label
|
For example the response if found is
{ "status": "OK", "oid": 1, "className": "android.widget.TextView"}
Sets the resource name criteria for matching. A UI element will be considered a match if its resource name exactly matches the selector parameter and all other criteria for this selector are met.
parameter | description | example |
---|---|---|
uiSelector | the selector |
[email protected]:id/d0_label
|
bySelector | the selector |
[email protected]:id/d0_label
|
The format of the selector string is
sel@[$]value,...
Where sel can be one of
- clickable
- depth
- desc
- res
- text
- scrollable
For example the response if found is
{ "status": "OK", "oid": 1, "className": "android.widget.TextView"}
For example a response could be
{"currentPackageName":"com.android.calendar"}
For example a response could be
{"displayHeight":1776}
For example a response could be
{"displayRotation":0}
For example a response could be
{"displaySizeDpX":360,"displaySizeDpY":640}
For example a response could be
{"displayWidth":1080}
For example a response could be
{"lastTraversedText":""}
For example a response could be
{"productName":"aosp_hammerhead"}
Presses the BACK key.
Presses the HOME key.
Presses a specific key code.
parameter | description | example |
---|---|---|
keyCode | the key code int value as specified in http://developer.android.com/reference/android/view/KeyEvent.html |
keyCode=8
|
metaState | the meta state |
metaState=0
|
Press the RECENT APPS button.
Produces a swipe gesture on the device. Swipe can be invoked with 2 different set of parameters.
parameter | description | example |
---|---|---|
startX | origin x |
startX=100
|
startY | origin y |
startY=100
|
endX | finishing x |
endX=500
|
endY | finishing y |
endY=500
|
steps | number of steps |
steps=25
|
parameter | description | example |
---|---|---|
segments | sequence of point coordinates |
segments=0,0,100,100,100,500,...
|
segmentSteps | steps between points |
segmentSteps=20
|
These are 3 examples of different segmentSteps
segments = [100, 400, 300, 700, 300, 1000, 600, 1000, 800, 100] for s in [3, 10, 30]: self.vc.swipe(segments=segments, segmentSteps=s)
Takes the current screenshot of the device.
parameter | description | example |
---|---|---|
scale | the scale of the image (not supported bu UiAutomator yet) |
scale=0.5
|
quality | the quality of the image (not supported bu UiAutomator yet) |
quality=100
|
Waits for device to be idle.
parameter | description | example |
---|---|---|
timeout | the timeout in ms |
timeout=1000
|
Waits for a window content update event to occur. If a package name for the window is specified, but the current window does not have the same package name, the function returns immediately.
parameter | description | example |
---|---|---|
packageName | the package name or null |
packageName=com.android.calculator2
|
timeout | the timeout in ms |
timeout=1000
|
Clicks on the specified object. The target object should have been found using RESTful-API#findObject with *uiSelector*.
Clicks on the specified object. The target object should have been found using RESTful-API#findObject with *bySelector*.
Clicks on the specified object and waits for the condition.
parameter | description | example |
---|---|---|
eventCondition | the event condition to wait |
eventCondition=until:newWindow
|
timeout | the timeout in ms |
timeout=1000
|
The format of the event condition string is
event:conditon@value,...
Where event can be one of
- until
- newWindow
- scrollFinished@direction