WebDriver spec protocol for smart phone testing draft. For iOS and Android
One day I decide to make a phone manager platform and also decide to let this platform to support some REST API that can easily operate phone.
Then I google something relative, and found WebDriver spec, saddly this is decided for web testing, not for phone. Project facebook/WebDriverAgent is a good project that can reference, make some extension for WebDriver spec. So I decide to write it out as a draft, that will guide that phone manager platform develop in a right direction.
- Some are from WebDriver spec
- facebook/WebdriverAgent project
This is list of most common endpoints with some query examples using curl with pre-set environment variables:
DEVICE_URL
set as device URL (eg. http://somehost/webdriver)SESSION_ID
set as session id. Returned by start session command e.g. D15E12F6-CA23-4CD4-89F9-E5C5EA6F4FADJSON_HEADER='-H "Content-Type: application/json"'
The RESTful API split into two part, session apis and without session apis.
APIs do not need a app started.
GET /windows/size
$ curl -X POST -d '{"key": "HOME"}' $DEVICE_URL/keyevent
{
"status": 0,
"value": "keyevent: HOME"
}
Android key
can be the following string.
- HOME
- EDIT
- BACK
more see here
iOS got only HOME
works
$ curl -X GET $DEVICE_URL/screenshot
{
"status": 0,
"value": "{base64 encoded data}"
}
Create a session
POST /session
GET /session
DELETE /session/{sessionId}
Most API reference openstf REST API
TODO here.
$ curl -H "Authorization: Bearer YOUR-TOKEN-HERE" /api/user
{
"email": "someone@hostname.com",
"name": "无名",
"nickname": "unknown",
"id": "https://login.netease.com/openid/unknown/"
}
Attempts to add a device under the authenticated user's control. This is analogous to pressing "Use" in the UI.
$ curl -X POST --data '{"serial":"EP7351U3WQ"}' /api/user/devices
{
"success": true
}
$ curl -X DELETE /api/user/devices/{serial}
{
"success": true
}
Allows you to retrieve the remote debug URL(i.e. an adb connect
able address)
$ curl -X POST /api/devices/{serial}/remoteConnect
{
"success": true,
"description": "Device connected",
"remoteConnectUrl": "10.0.0.1:5555"
}
Disconnect a remote debugging session.
$ curl -X DELETE /api/devices/{serial}/remoteConnect
{
"success": true
}
$ curl -X POST --data '{"apkUrl":"https://static.dongqiudi.com/app/apk/dongqiudi_website.apk"}' /api/device/{serial}/installApk
{
"success": true,
"taskId": 1
}
Under GPL 3