Airtest 处理安卓手机 touch() 失效问题

前段时间买了个LG v40 做自动化的手机,配置什么的都还不错,就是touch() , click() ,drug() 这些交互操作,经常会遇到没反应的情况。在官网也找了 touch() 失效可能存在的问题,但不管是测试报告还是打断点,都没任何问题。


测试报告

后来暴力使用 touch([1341,187],duration=0.1)直接在坐标点击,发现了问题所在。
屏幕尺寸居然和设备尺寸不一致

device = device()
display_info = device.get_display_info()
print(f'display info {display_info}') 
-------
display info {'width': 1080, 'height': 2340, 'density': 3.5, 'orientation': 0, 'rotation': 0, 'max_x': 1439, 'max_y': 3119}

可以发现max_x,max_y 是14403200,但是宽高是10802340,在手机设置里面发现,分辨率改成了中分辨率10802340,当我把分辨率切回14403200后,交互就可以正常执行了。

你可能感兴趣的:(Airtest 处理安卓手机 touch() 失效问题)