Skip to content

swipe coordinates wrong on ios with appium 1.5 #137

@toejough

Description

@toejough

The swipe action for python is documented as:

# python
driver.swipe(start_x, start_y, end_x end_y, duration)

If you use it that way on iOS, though, the server translates those values as start_x, start_y, offset_x, offset_y, duration.

I'm running python client v0.22 and appium server v1.5.3.

Here's a snippet of my server log:

[HTTP] --> POST /wd/hub/session/7e26de34-dbc4-428e-965c-5513d3036bf2/touch/perform {"sessionId":"7e26de34-dbc4-428e-965c-551
3d3036bf2","actions":[{"options":{"y":437,"x":134},"action":"press"},{"options":{"ms":500},"action":"wait"},{"options":{"y":
437,"x":272},"action":"moveTo"},{"options":{},"action":"release"}]}
[MJSONWP] Calling AppiumDriver.performTouch() with args: [[{"options":{"y":437,"x":1...
[debug] [iOS] Executing iOS command 'performTouch'
[debug] [UIAuto] Sending command to instruments: target.touch([{"touch":[{"x":134,"y":437}],"time":0.2},{"touch":[{"x":134,"
y":437}],"time":0.7},{"touch":[{"x":406,"y":874}],"time":0.8999999999999999}])
[debug] [Instruments] [INST] 2016-07-08 19:52:05 +0000 Debug: Got new command 87 from instruments: target.touch([{"touch":[{
"x":134,"y":437}],"time":0.2},{"touch":[{"x":134,"y":437}],"time":0.7},{"touch":[{"x":406,"y":874}],"time":0.899999999999999
9}])
[debug] [Instruments] [INST] 2016-07-08 19:52:05 +0000 Debug: evaluating target.touch([{"touch":[{"x":134,"y":437}],"time":0
.2},{"touch":[{"x":134,"y":437}],"time":0.7},{"touch":[{"x":406,"y":874}],"time":0.8999999999999999}])
[debug] [Instruments] [INST] 2016-07-08 19:52:05 +0000 Debug: target.touch(__NSCFArray)
[debug] [Instruments] [INST] 2016-07-08 19:52:05 +0000 Debug: point is not within the bounds of the screen

The bounds of the screen: [MJSONWP] Responding to client with driver.getWindowSize() result: {"width":375,"height":667}

The swipe action was called like device.swipe(134, 437, 272, 437, 500). The documentation says that means from {"x":134,"y":437} to {"x":272,"y":437}, which is in the bounds of the screen.

The coordinates apparently passed to instruments were from {"x":134,"y":437} to {"x":406,"y":874}, which is outside the bounds of the screen.

I'd blame this on the server, but appium/java-client#350 and appium/appium#6519 lead me to believe the server behavior is expected with appium 1.5, and the client needs to be updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions