最近在做 IOS 的 appium 脚本的时候遇到了一些问题:
在操作 swipe 时,发现在 ios 上并没有移动。
看了一下 log:
info: [debug] Socket data received (93 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":17,"value":"duration value must be greater than or equal to 0.5 or less than 60"}
info: [debug] Responding to client with error: {"status":17,"value":{"message":"An error occurred while executing user supplied JavaScript.","origValue":"duration value must be greater than or equal to 0.5 or less than 60"},"sessionId":"6c99f732-dbd1-45f7-ac43-a567202c2d64"}
info: <-- POST /wd/hub/session/6c99f732-dbd1-45f7-ac43-a567202c2d64/touch/perform 500 262.950 ms
意思是说 duration 参数单位应该是秒。
但是在代码里,看到的源码是:
/**
* @see TouchShortcuts#swipe(int, int, int, int, int)
*/
@Override
public void swipe(int startx, int starty, int endx, int endy, int duration) {
TouchAction touchAction = new TouchAction(this);
// appium converts press-wait-moveto-release to a swipe action
touchAction.press(startx, starty).waitAction(duration)
.moveTo(endx, endy).release();
touchAction.perform();
}
单位是毫秒。
我 server 版本是 1.4.8,client 版本是 3.1.0,ios 模拟的是 8.4 版本,为什么会有这样的差异,是我版本用的不匹配么?
ios 端 swipe 该如何处理?