chore: 提交现有客户端自动化代码
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import time
|
||||
def wait_goods_page(device, timeout=30):
|
||||
end_time = time.monotonic() + timeout
|
||||
|
||||
while time.monotonic() < end_time:
|
||||
current = device.app_current()
|
||||
|
||||
if current.get("package") != "com.xunmeng.pinduoduo":
|
||||
time.sleep(1)
|
||||
continue
|
||||
|
||||
ready = any([
|
||||
bool(device(textContains="发起拼单").exists),
|
||||
bool(device(textContains="立即购买").exists),
|
||||
bool(device(textContains="单独购买").exists),
|
||||
bool(device(textContains="快要抢光").exists),
|
||||
bool(device(textContains="免拼购买").exists),
|
||||
])
|
||||
|
||||
loading = any([
|
||||
bool(device(textContains="加载中").exists),
|
||||
bool(device(textContains="正在加载").exists),
|
||||
])
|
||||
|
||||
if ready and not loading:
|
||||
return True
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
return False
|
||||
Reference in New Issue
Block a user