POCO软件测试自学,自动化UI测试工具airtest 之V2.2 airtest文档学习POCO

airtest project界面.jpg

学习AirtestIDE官方文档

poco对象UI选取法text与name法.jpg

from poco.drivers.android.uiautomation import AndroidUiautomationPoco

#poco实例化

poco = AndroidUiautomationPoco(use_airtest_input=True,

screenshot_each_action=False)

#选取:

poco(text=”看一看”).click()

或:

poco(name=”android:id/title”).click()

UI 路径(UI path)法:

AirtestIDE中选中UI,则可以选中路径后鼠标右键,得到UI 路径:

poco(“com.tencent.mm:id/bp”).offspring(“android:id/list”).child(“com.tencent.mm:id/d9u”)[2].child(“com.tencent.mm:id/m5”).offspring(“com.tencent.mm:id/l5”).child(“android.widget.LinearLayout”).offspring(“android:id/title”)

引用文档中的坐标图

AirtestIDE中可以设置选项,这样在界面中可能显示详细的坐标值。

684efbd264a6tm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

UI坐标g

代码实例:

# -*- encoding=utf8 -*-

__author__ = “Administrator”

from airtest.core.api import *

from poco.drivers.android.uiautomation import AndroidUiautomationPoco

poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)

# script content

print(“start…”)

# generate html report

# from airtest.report.report import simple_report

# simple_report(__file__, logpath=True)

pp = poco(name=”com.bbk.launcher2:id/item_title”)

print(len(pp))

#打印出每一个UI的texts

for pname in poco(name=”com.bbk.launcher2:id/item_title”):

print(pname.get_text())

#等待理财UI出现,才执行下一句

poco(text=’理财’).wait_for_appearance()

poco(text=”理财”).long_click()

poco(text=”理财”).swipe(‘down’)

相关资源:陈式太极拳教学软件+注册机1-专业指导文档类资源-CSDN文库

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年6月19日
下一篇 2021年6月19日

相关推荐