Commit e52dcf7f authored by TesterYao's avatar TesterYao

1

parent ce451d60
from airtest.core.api import *
from poco.drivers.ios import iosPoco
from log import LOG
from ssp import SSP
def check_ex():
LOG.info('判断是否在微信首页')
if not poco("快捷操作").exists():
LOG.info('不在微信首页,重新打开微信')
device.stop_app('com.tencent.xin')
device.start_app('com.tencent.xin')
if poco("扫一扫").exists():
poco("快捷操作").click()
def check_wx():
LOG.info('判断微信是否异常')
while poco(name="下一步").exists():
LOG.info('微信异常,点击下一步')
poco(name="下一步").click()
if poco(name="进入微信").exists():
LOG.info('点击进入微信')
poco(name="进入微信").click()
def runner(channel):
block_list = []
url_list = channel.get_valid_list()
for i in url_list:
touch(Template(r"tpl1648532405768.png", record_pos=(-0.412, -0.689), resolution=(750, 1334)))
text(i)
touch(Template(r"tpl1648532410590.png", record_pos=(0.468, -0.58), resolution=(750, 1334)))
try:
if wait(Template(r"tpl1648533639149.png", record_pos=(-0.007, -0.552), resolution=(750, 1334)), timeout=4):
block_list.append(i)
LOG.info('巡查结束,域名被封:'+i)
else:
LOG.info('巡查结束,域名正常:'+i)
except TargetNotFoundError:
LOG.info('巡查结束,域名正常:'+i)
return block_list
if __name__ == '__main__':
ssp = SSP()
LOG.info('开始连接设备')
device = connect_device('ios:///http://127.0.0.1:8100')
LOG.info('连接成功')
poco = iosPoco()
# while True:
# try:
# check_ex()
# check_wx()
# check_ssp()
# check_pg()
# except Exception as e:
# print(e)
# LOG.error('域名巡查脚本报错,三分钟后重试!')
# sleep(30)
t = 0
for i in range(5):
# poco(name='TextField').click()
# touch(Template(r"tpl1648532405768.png", record_pos=(-0.412, -0.689), resolution=(750, 1334)))
text('https://www.baidu.com')
time0 = time.time()
# poco(name='确定').click()
touch(Template(r"tpl1648532410590.png", record_pos=(0.468, -0.58), resolution=(750, 1334)))
# poco("TextField").set_text('http://activity.tuia.cn')
# sleep(3.5)
try:
if wait(Template(r"tpl1648533639149.png", record_pos=(-0.007, -0.552), resolution=(750, 1334)),timeout=4):
print('巡查结束,域名被封')
else:
print('巡查结束,域名正常')
except TargetNotFoundError:
print('巡查结束,域名正常')
time1 = time.time()
# poco('返回').click()
# touch(Template(r"tpl1648524697053.png", record_pos=(-0.136, 0.824), resolution=(750, 1334)))
touch(Template(r"tpl1648534781601.png", record_pos=(-0.427, -0.78), resolution=(750, 1334)))
time2 = time.time()
# poco(name='更多').click()
# touch(Template(r"tpl1648524738971.png", record_pos=(0.421, -0.776), resolution=(750, 1334)))
# touch(Template(r"tpl1648534817811.png", record_pos=(0.021, -0.085), resolution=(750, 1334)))
touch(Template(r"tpl1648535033576.png", record_pos=(0.187, -0.317), resolution=(750, 1334)))
time3 = time.time()
# poco(name='刷新').click()
# touch(Template(r"tpl1648524753827.png", record_pos=(0.145, 0.567), resolution=(750, 1334)))
# sleep(1)
# time4 = time.time()
tl = time3 - time1
t += tl
print(time0 - timex)
print(time1-time0)
print(time2 - time1)
print(time3 - time2)
# print(time4 - time3)
print('*'*35)
print('=' * 30)
print(t / 100)
...@@ -48,7 +48,7 @@ def scan(photo): ...@@ -48,7 +48,7 @@ def scan(photo):
def check_ssp(): def check_ssp():
LOG.info('巡查ssp') LOG.info('巡查ssp')
b_list = scan("照片15,拍摄时间,2022年2月17日 下午4:47") b_list = scan("照片1,拍摄时间,2022年2月17日 下午4:47")
if b_list: if b_list:
LOG.info('巡查ssp结束,被封列表:' + str(b_list)) LOG.info('巡查ssp结束,被封列表:' + str(b_list))
for domain in b_list: for domain in b_list:
...@@ -57,7 +57,7 @@ def check_ssp(): ...@@ -57,7 +57,7 @@ def check_ssp():
def check_pg(): def check_pg():
LOG.info('巡查盘古') LOG.info('巡查盘古')
b_list = scan("照片16,拍摄时间,2022年2月17日 下午4:47") b_list = scan("照片2,拍摄时间,2022年2月17日 下午4:47")
if b_list: if b_list:
LOG.info('巡查盘古结束,被封列表:'+str(b_list)) LOG.info('巡查盘古结束,被封列表:'+str(b_list))
for domain in b_list: for domain in b_list:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment