Airtest 滑动

上下滑动

# -*- encoding=utf8 -*-
__author__ = "yuanshi"

from airtest.core.api import *
from airtest.cli.parser import cli_setup

from poco.drivers.android.uiautomation import AndroidUiautomationPoco
from airtest.core.api import *
from airtest.core.android.adb import *
from airtest.core.android.android import *
import time
class_name = '0ade5fc00bffda78'
connect_device(f"Android:///{class_name}?cap_method=JAVACAP&&ori_method=ADBORI&&touch_method=ADBTOUCH")
set_current(class_name)
dev = device()

poco = AndroidUiautomationPoco(device=dev, use_airtest_input=True, screenshot_each_action=False)
# 获取设备的高度和宽度
width, height = poco.get_screen_size()
# 校准滑动的起点和终点
start_pt = (width * 0.5, height * 0.8)
end_pt = (width * 0.5, height * 0.2)
while 1:
    swipe(start_pt, end_pt)
    time.sleep(1)

待续

posted @ 2020-11-12 17:33  莫贞俊晗  阅读(398)  评论(0编辑  收藏  举报