airtest使用自定义手势报错

from airtest.core.api import *
from airtest.core.android.minitouch import *
from airtest.core.android.base_touch import *
def switch():
    init_device()
    connect_device("Android:///b5978261?cap_method=javacap&touch_method=adb")
    a_event = [DownEvent([49, 173]), SleepEvent(2), UpEvent(0)]
    device().minitouch.perform(a_event)


def get_info():
    os.system('adb  shell getprop ro.product.model')  # 手机型号
    os.system('adb  shell wm size')  # 分辨率
    os.system('adb  shell getprop ro.build.version.release')  # 版本


if __name__ == '__main__':
    get_info()
    switch()

img

出现这个报错,最常见的是以下俩种情况:

① 手机系统是MIUI11,此时我们需要在点击“connect”按钮之前,把 “use Javacap + use orientation” 这两个选项勾选上,再点击“connect”按钮即可正常使用

② 手机的安卓版本是Android10,此时仅需要把IDE更新到最新版本即可;如果IDE使用的是本地的python环境,那还需要把本地python环境的Airtest更新到最新版本。
————————————————

原文链接:https://blog.csdn.net/AirtestProject/article/details/104816017