-
Notifications
You must be signed in to change notification settings - Fork 38
/
HPV_MiaoMiao.py
55 lines (39 loc) · 1.27 KB
/
HPV_MiaoMiao.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import uiautomator2 as u2
import datetime
import time
now = time.strftime("%Y-%m-%d %H:%M:%S.", time.localtime())
def logger(msg):
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
print(current_time, msg)
def QiangYiMiao():
logger("通过USB连接手机")
device = u2.connect_usb()
# logger("通过WiFi连接手机")
# device = u2.connect('192.168.0.106')
logger("停止微信")
device.app_stop("com.tencent.mm")
time.sleep(2)
logger("启动微信")
device.app_start("com.tencent.mm") # 启动微信
time.sleep(5) # 休息3秒,等待启动
logger("点击 发现")
device.click(682, 2171)
time.sleep(1)
logger("点击 小程序")
device(text="小程序").click()
time.sleep(1)
logger("点击 秒苗")
device(text="秒苗").click()
time.sleep(5)
logger("点击首页")
device.click(270.0, 2142.0) # 点击 首页
time.sleep(2) # 休息1秒,等待页面反应过来
logger("点击进入抢购页面")
device.click(890.0, 862.0)
time.sleep(2) # 休息2秒,等待页面反应过来
count = 1
while True:
logger(f"点击抢购第{count}次")
device.click(470.0, 2142.0) # 点击,抢购按钮
count += 1
QiangYiMiao()