MCPcopy
hub / github.com/MonsterNone/tmall-miao / do_time_task_energy

Function do_time_task_energy

modules/energy.py:113–136  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

111
112# 能量浏览任务
113def do_time_task_energy():
114 logger.info('等待进入')
115 if not find_timeout_re(d, '下滑浏览15秒', 5):
116 logger.info('未能检测到进入任务,退出')
117 exit(0)
118 n = 0
119 logger.info('进行任务')
120 while True:
121 if not d.xpath('//*[contains(@text, "下滑浏览15秒")]').exists() and not d.xpath(
122 '//*[contains(@text, "已浏览") and contains(@text, "秒")]').exists():
123 logger.info('浏览完成')
124 break
125 if n > 15:
126 logger.info('任务循环过长,终止')
127 break
128 w, h = d.display_size
129 d.swipe(x1=w / 2, y1=h - 300, x2=w / 2 + 100, y2=h - 600)
130 n += 1
131
132 if n > 15:
133 return False
134
135 logger.info('任务已完成')
136 return True
137
138
139def do_search_task_energy():

Callers 2

do_search_task_energyFunction · 0.85
runFunction · 0.85

Calls 3

find_timeout_reFunction · 0.90
xpathMethod · 0.80
swipeMethod · 0.80

Tested by

no test coverage detected