先下载auto.js App
下载地址 https://download.csdn.net/download/liuhao9999/13192815
auto.waitFor();
app.launchApp('今日头条极速版');
sleep(7000);
if (text('取消').exists()) {
text('取消').findOnce().click();
toastLog('cancel')
}
toastLog('run main');
setScreenMetrics(device.width, device.height);
click(device.width / 2, device.height / 2);
sleep(2000)
num = 1;
while (true) {
index1 = random(-100, 100);
index2 = random(-80, 80);
index3 = random(-100, 100);
index4 = random(-10, 10);
zan();
swipe(device.width / 2 + index1, device.height / 1.2 + index3,
device.width / 2 + index2, device.height / 6 + index4, 900);
sleepTime = random(7000, 10000);
var c = num++;
toastLog('swipe' + c + 'num');
sleep(sleepTime);
}
P
//random zan
function zan() {
var ran = random(1, 3);
if (id('image_view').exists() && ran == 2) {
var rect = id('image_view').findOnce().bounds();
click(rect.centerX(), rect.centerY());
toastLog('random zan ok!');
sleep(2000);
} else {
return;
}
}