Skip to content
Chris Fuentes edited this page Feb 5, 2016 · 8 revisions

General

/health

GET /health

Hopefully prints a nice, welcoming message.

Lifecycle

/session

POST /session {
    "bundleID" : "com.companyname.example",
    "bundlePath" : "/abs/path/to/MyApp.app", // optional if app already installed
    "launchArgs" : [ "arg1", "arg2", ... ], // optional
    "environment" : { "key" : "val", ... } // optional
} 

Starts/launches the specified app

DELETE /session  

Kills the current application. As a side effect of a known issue in XCUITest, also kills the server.

POST /shutdown

POST /shutdown {
}

Shuts the server down by forcing it to exit(0).

Gestures

/swipe/:direction

POST /swipe/{up, down, left, right}

Performs a swipe action on the entire app screen. Doesn't seem to be a way to control velocity.

/tap/coordinates

POST /tap/coordinates {
    "x" : Number,
    "y" : Number
}

Performs a tap gesture at OpenGL position x, y on the main screen. The coordinate space is the resolution of the screen, not the size of the app window (e.g. on an iPad, if your app is running at 1x, the coordinates for an element will be different than if it is running at 2x. The boundaries of the screen would be 0,0,1024,768).

/doubleTap/coordinates

POST /doubleTap/coordinates
{ 
    x : Number,
    y : Number
}

/pressForDuration/coordinates

POST /pressForDuration/coordinates
{ 
    x : Number,
    y : Number,
    duration: Number
}

/pressForDuration/coordinates/thenDragTo

POST /pressForDuration/coordinates/thenDragTo
{ 
    x1 : Number,
    y1 : Number,
    x2 : Number,
    y2 : Number,
    duration: Number
}

/tap/marked/:text

POST /tap/marked/:text
{ }

/doubleTap/marked/:text

POST /doubleTap/marked/:text
{ }

/twoFingerTap/marked/:text

POST /twoFingerTap/marked/:text
{ }

/swipe/:direction/marked/:text

POST /swipe/{up, down, left, right}/marked/:text
{ }

/pinchWithScaleAndVelocity/marked/:text

POST /pinchWithScaleAndVelocity/marked/:text
{
    scale: Number, //1.0 == no zoom, < 1.0 == zoom out
    velocity: Number //"scale points per second"
}

/rotateWithVelocity/marked/:text

POST /rotateWithVelocity/marked/:text
{
    degrees: Number,
    velocity: Number //degrees per second
} 

/typeText/marked/:text

POST /typeText/marked/:text
{
    text: String //string to type
}

/tapWithNumberOfTapsAndTouches/marked/:text

POST /tapWithNumberOfTapsAndTouches/marked/:text
{
    taps : Number,
    touches : Number
}

/pressForDuration/marked/:text

POST /pressForDuration/marked/:text
{
    duration: Number
}

/pressForDuration/marked/:text1/thenDragToElement/marked/:text2

POST /pressForDuration/marked/:text1/thenDragToElement/marked/:text2
{
    duration: Number
}

*/id/:id

[Note, the following APIs are identical to the 'marked' APIs except for using /id/:id in place of /marked/:text in the route name].

  • /tap/id/:id
  • /doubleTap/id/:id
  • /twoFingerTap/id/:id
  • /swipe/:direction/id/:id
  • /pinchWithScaleAndVelocity/id/:id
  • /rotateWithVelocity/id/:id
  • /typeText/id/:id
  • /tapWithNumberOfTapsAndTouches/id/:id
  • /pressForDuration/id/:id
  • /pressForDuration/id/:id1/thenDragToElement/id/:id2

Queries

/tree

GET /tree

Returns a JSON dump of the current view hierarchy. It's not super informative, as the XCUIElements are really just proxy representations of the native views and thus don't contain a lot of information. However, you can glean basic knowledge about what's present. A typical element looks like:

{
    "enabled": true,
    "id": "Settings",
    "title": "",
    "rect": {
      "y": 20,
      "x": 0,
      "height": 44,
      "width": 375
    },
    "label": "",
    "value": "",
    "type": 21, //we can stringify this at some point, the numbers correspond to more informative 'XCUIElemenTypes'
    "children" : [ ... ] //only present if there are children. 
  }

/query/marked/:text

GET /query/marked/:text

Returns an array of elements with value, label, or title == :text. Format is the same as tree, minus the children.

/query/marked/:id

GET /query/id/:id

Returns an array of elements with identifier or accessibilityIdentifier == :id. Format is the same as tree, minus the children.

Clone this wiki locally