栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

python-自动化Airtest-2代码篇 Airtest包

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

python-自动化Airtest-2代码篇 Airtest包

python-自动化Airtest-2代码篇 Airtest包

代码篇 Airtest包
  • 一: connect_device 代码
    • 1> auto_setup
    • 2> Template
    • 3> other airtest.core.api
      • 1. init_device
      • 2. device&connect_device&set_current
    • 二级目录
      • 三级目录

一: connect_device 代码

更完备的 airtest.core.api
https://airtest.readthedocs.io/en/latest/all_module/airtest.core.api.html

1> auto_setup
auto_setup(__file__, logdir=True, devices=["platform://host:host/uuid?cap_method=value&&ori_method=value",])

platform: Android/iOS/Windows…
host: Android平台是adb host,iOS下是iproxy host,其他平台请留空
port: Android下是adb port,iOS下填写iproxy port,其他平台请留空
uuid: 目标设备的uuid,例如Android下是序列号,windows下是窗口句柄,iOS是uuid
param: 设备初始化的配置字段,例如cap_method/ori_method/…
value: 设备初始化字段的值。

2> Template

把图片转为代码

Template(r"tpl1532588127987.png", record_pos=(0.779, 0.382), resolution=(407, 264), threshold=0.6, target_pos=5, rgb=False)

参数分别为:截取的图片名, record_pos记录坐标, resolution 分辨率,threshold阈值,target_pos图像点击位置
截取的图片名:可添绝对路径、相对路径
record_pos:记录坐标
resolution :分辨率
threshold:浮点型
target_pos:图像点击位置,向上节IDE介绍1-9 个位置;默认都为5

3> other airtest.core.api 1. init_device

如果还没有初始化设备,则设置为当前设备

init_device(platform='Android', uuid=None, **kwargs)

参数:
platform :平台– Android, IOS or Windows
uuid :设备号
kwargs :可选的平台其他特定关键字参数

例如:
init_device(platform=“Android”,uuid=“SJE5T17B17”, cap_method=“JAVACAP”)

2. device&connect_device&set_current 二级目录 三级目录
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/965005.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号