用的 appium 1.2.0 版本
1.TouchAction 失败
一开始使用的 TouchAction(driver).press(x=150, y=100).move_to(x=250, y=100).release().perform()
失败,总是 404,查询了一些资料说 chrome 下是不支持 TouchAction 的
2.mobile: swipe 失败
driver.execute_script('mobile: swipe', {'duration': 0.5, 'startX': 100, 'startY': 100, 'endX': 200, 'endY': 100})
失败,报错 ↓
debug: Appium request initiated at /wd/hub/session/76891c298f4443cb292fc608ff4fa211/execute
debug: Request received with params: {"sessionId":"76891c298f4443cb292fc608ff4fa211","args":[{"duration":0.5,"endX":200,"startX":100,"startY":100,"endY":100}],"script":"mobile: swipe"}
debug: Pushing command to appium work queue: ["swipe",{"startX":100,"startY":100,"endX":200,"endY":100,"steps":14}]
error: Unhandled error: TypeError: Cannot call method 'sendAction' of null
at null. (C:\Users\chengaomin\Desktop\Appium\node_modules\appium\lib\devices\android\android.js:459:24)
at Object.q.process as _onImmediate
at processImmediate as _immediateCallback context: [POST /wd/hub/session/76891c298f4443cb292fc608ff4fa211/execute {"duration":0.5,"endX":200,"startX":100,"startY":100,"endY":100,"touchCount":1,"element":null}]
又查了一些资料,有人说 chrome 下也不支持 mobile:tap,swipe 等。不知道是不是真这样
已经解决,看一楼回复