如点击软件许可协议
# -*-coding:utf-8-*-
# !/usr/bin/python
import uiautomator2 as u2
import public.common as common
import public.const as const
import public.system as system
__author__ = 'Administrator'
'''
@Project: pythonProject_baidu
@File : click_offset.py
@Time : 2022/1/3 16:20
@Author : Administrator
#=====================================#
@TestCase_Title:
@Level:
@Precondition:
@Step:
@Result:
#=====================================#
'''
def setup():
print("前置条件")
def test_step():
print("执行步骤")
d(resourceId="com.UCMobile:id/hint").click(offset=(0.5,0.8))
#若位置不确定可以列表循环点击
x = (0, 0.25, 0.5, 0.75, 1)
y = (0, 0.25, 0.5, 0.75, 1)
for i in x:
for j in y:
d(resourceId="com.UCMobile:id/hint").click(offset=(i, i),timeout=0.5)
if d(resourceId="com.UCMobile:id/hint").exists(timeout=0.5):
continue
else:
break
def teardown():
print("后置方法")
if __name__ == "__main__":
d = u2.connect(common.sn)
try:
setup()
test_step()
except Exception as e:
common.screenshot("err")
raise e
finally:
teardown()