-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
executable file
·39 lines (39 loc) · 984 Bytes
/
main.js
File metadata and controls
executable file
·39 lines (39 loc) · 984 Bytes
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
const appName = "盒马";
launchApp(appName);
sleep(3000);
auto.waitFor()
// 点击按钮
const clickSettle = () => {
id('button_cart_charge').findOne().click()
}
const hasText = (text) => {
return textStartsWith(text).exists() // 是否存在指定文本
}
const musicNotify = () => {
const m = '/storage/emulated/0/Android/data/com.tencent.mm/MicroMsg/Download/大籽-白月光与朱砂痣.mp3'
media.playMusic(m);
sleep(media.getMusicDuration());
}
const start = () => {
// 是否有结算按钮
if (hasText("结算")) {
// 点击结算
clickSettle()
sleep(1000)
start()
} else if (hasText('非常抱歉,当前商品运力不足(063)') || hasText('很抱歉,下单失败')) {
// 返回上一页
back()
sleep(1000)
start()
} else if (hasText('提交订单')) {
className("android.widget.TextView").text("提交订单").findOne().parent().click()
musicNotify()
sleep(1000)
start()
} else {
toast('停止活动了')
musicNotify()
}
}
start()