Skip to content

Instantly share code, notes, and snippets.

@flzq
Created February 4, 2019 14:37
Show Gist options
  • Save flzq/840b36851127fc84844136f6e31517b5 to your computer and use it in GitHub Desktop.
Save flzq/840b36851127fc84844136f6e31517b5 to your computer and use it in GitHub Desktop.
红包
cnt = 0
while True:
result_list = poco(name="com.tencent.mm:id/aou", type='android.widget.LinearLayout')
# 开始时等待红包
while cnt == 0:
result_list = poco(name="com.tencent.mm:id/aou", type='android.widget.LinearLayout')
if result_list:
cnt = 1
break
else:
print('等待红包')
if result_list:
for result in result_list:
if result:
print('有红包')
result.click()
# 点开红包后的判断页面
if poco("com.tencent.mm:id/jd"): # 已经领取了红包,到了详情页面,返回
print('已经领取了')
# 从详情页面返回
poco("com.tencent.mm:id/kb").click()
else: # 手慢无或有红包未领取
if poco("com.tencent.mm:id/cyf"): # 红包未领取完
print('红包未领取,领取红包')
# 开红包
poco("com.tencent.mm:id/cyf").click()
# 然后从详情页面返回
poco("com.tencent.mm:id/kb").click()
else: # 红包已经领取完
print('红包已经领完了')
# 关闭
poco("com.tencent.mm:id/cv0").click()
else:
print('没有')
# 滑动页面
poco.swipe([1, 0.2], [1, 0.9])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment