appium 版本:1.6.1
安卓版本:6.0
我的代码如下:

print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))
TouchAction(self.driver).long_press(element, None, None, 5000).perform()
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))

执行没有报错,打印的时间也确实相差 5 秒,但是手机界面没有出现快捷操作(正常情况长按会出现快捷操作小图标),而是直接点进来,跳入新的界面。
appium 日志貌似也很正常,日志如下:

{}}],"sessionId":"c7351609-c95f-4e5c-b033-6fe7d7fafcda"}
[MJSONWP] Calling AppiumDriver.performTouch() with args: [[{"action":"longPress","options":{"x":null,"y":null,"duration":5000}},{"action":"release","options":{}}],"c7351609-c95f-4e5c-b033-6fe7d7fafcda"]
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:touchLongClick","params":{"x":0,"y":0,"duration":5000}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:touchLongClick","params":{"x":0,"y":0,"duration":5000}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: touchLongClick
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Display bounds: [0,0][720,1208]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Performing TouchLongClick using element? false x: 360, y: 604, duration: 5000
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true}
[AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.performTouch() result: null
[HTTP] <-- POST /wd/hub/session/c7351609-c95f-4e5c-b033-6fe7d7fafcda/touch/perform 200 5194 ms - 76
[HTTP] 

请问这个是什么原因呢


↙↙↙阅读原文可查看相关链接,并与作者交流