autopc.basic.basic_airtest module
- class BasicAirtest[源代码]
基类:
objectairtest的基础api
- static auto_setup(connect_name: str, device_type: str = 'Android', ip: str = '127.0.0.1:5037', hwnd: str = '', title: str = '')[源代码]
设备连接,支持Android和Windows,默认使用Android连接
- 参数:
connect_name – 连接名称
device_type – 设备类型
ip – IP和端口(Android连接)
hwnd – 句柄(windows连接)
title – 窗口标题(windows连接)
- 返回:
None
- static snapshot(img_path: str = '')[源代码]
设备截图函数,打印或不打印图片到指定路径
- 参数:
img_path – 图片路径及名称(打印)
- 返回:
ndarray
- static loop_find(template: Template, timeout=20, threshold=None, interval=0.5, intervalfunc=None, random_area=0)[源代码]
判断模板图片在设备上是否存在,如果存在返回坐标
- 参数:
template – 图片类
timeout – 超时时间
threshold – 相似度
interval – 识别间隔
intervalfunc
random_area – 随机区域,默认0,取中心点,大于零小于等于1则区域内随机
- 返回:
- static exists(template: Template, cvstrategy: [] = ['mstpl', 'tpl', 'sift', 'brisk'], timeout: float = 3, random_area=0)[源代码]
判断模板图片在设备上是否存在,如果存在返回坐标
- 参数:
template – 图片类
cvstrategy – 图像识别算法
timeout – 超时时间
random_area – 随机区域,默认0,取中心点,大于零小于等于1则区域内随机
- 返回:
bool
- static touch(template: Template, cvstrategy: [] = ['mstpl', 'tpl', 'sift', 'brisk'], timeout: float = 3, times: int = 1, **kwargs)[源代码]
判断模板图片在设备上是否存在,如果存在点击 :param times: 点击次数 :param cvstrategy: 图像识别算法 :param template: 图片类 :param timeout: 超时时间 :return: bool
- static touch_coordinate(pos: (), times: int = 1, **kwargs)[源代码]
点击坐标 :param pos: 坐标信息(x,y) :param times: 点击次数 :return: bool
- static swipe(v1: [], v2: [], duration: float = 0.1)[源代码]
滑动 :param duration: 间隔 :param v1: 坐标1 :param v2: 坐标2 :return: bool
- static find_all(template: Template, cvstrategy: [] = ['mstpl', 'tpl', 'sift', 'brisk'], timeout: float = 20)[源代码]
在设备屏幕上查找所有出现的目标并返回它们的坐标
- 参数:
template – template对象
timeout – 超时时间
cvstrategy – 图像识别算法
- 返回:
[{‘result’: (x, y),’rectangle’: ( (left_top, left_bottom, right_bottom, right_top) ),’confidence’: 0.9},…]
- static cv_match(template: Template, screen, cvstrategy: [] = ['mstpl', 'tpl', 'sift', 'brisk'])[源代码]
图片中查找图片信息
- 参数:
template – 图片1 template格式
screen – 图片2 ndarray格式
cvstrategy – 图像识别算法
- 返回:
[{‘result’: (x, y),’rectangle’: ( (left_top, left_bottom, right_bottom, right_top) ),’confidence’: 0.9},…]