- auto.waitFor()
- var appRun = currentActivity()
- if(appRun != 'com.taobao.taobao') {
- launch("com.taobao.taobao");
- toast("打开手机淘宝中");
- waitForActivity("com.taobao.tao.TBMainActivity");
- }
- function run() {
- //这里刚刚发现一个bug,desc('捉猫猫')
- className('android.widget.LinearLayout').desc('捉猫猫').findOne().click()
- className('android.view.View').clickable(true).depth(18).indexInParent(5).findOne().click()
- sleep(3000)
- if (text("签到").exists()) {
- text("签到").findOne().click();
- sleep(1600);
- toast("签到成功")
- }
- if(text("去进店").exists()) {
- toast("开始进行 去进店 任务!")
- goShop()
- };
- if(text("去浏览").exists()) {
- toast("开始进行 去浏览 任务!")
- goBrowse()
- };
- }
- function goShop() {
- let x = device.width / 2, y = device.height / 5;
- for (let t = 1; t < 21; t++) {
- click(text("去进店").findOne().click())
- toast("点击去进店")
- sleep(2000)
- var task = className('android.view.View').depth(21).desc('任务完成').exists()
- while(!task) {
- swipe(x, 4*y, x, y,1000);
- sleep(3000)
- task = className('android.view.View').depth(21).desc('任务完成').exists()
- if (task) toast('任务完成');
- }
- back()
- toast("已经逛了" + t + "次")
- sleep(2000)
- }
- }
- function goBrowse() {
- while (text("去浏览").exists()) {
- //判断是否有去浏览
- text("去浏览").findOne().click();
- sleep(20000)
- back()
- sleep(2000)
- }
- }
- run()
复制代码
测试手机 :荣耀V9
系统环境要求: 安卓7.0及以上
auto.js 软件 链接: https://pan.baidu.com/s/1RvJXdhbom4dsHUxEJTXaAA 提取码: e8tn
|