|
|
@ -1,11 +1,11 @@ |
|
|
|
start(); |
|
|
|
|
|
|
|
|
|
|
|
function start() { |
|
|
|
function start () { |
|
|
|
auto.waitFor() |
|
|
|
var appName = "com.jingdong.app.mall"; |
|
|
|
var appName = "cn.youth.news"; |
|
|
|
if (launch(appName)) { |
|
|
|
console.info("启动中青看点"); |
|
|
|
console.info("启动中青看点"); |
|
|
|
} |
|
|
|
console.show(); |
|
|
|
} |
|
|
@ -15,42 +15,60 @@ function start() { |
|
|
|
* @param {横坐标} x |
|
|
|
* @param {纵坐标} y |
|
|
|
*/ |
|
|
|
function randomClick(x, y) { |
|
|
|
var rx = random(0, 5); |
|
|
|
var ry = random(0, 5); |
|
|
|
function randomClickObject (obj) { |
|
|
|
var rx = 0;// random(0, 5);
|
|
|
|
var ry = 0;// random(0, 5);
|
|
|
|
|
|
|
|
click(x + rx, y + ry); |
|
|
|
sleep(2000); |
|
|
|
if (obj && obj.click) { |
|
|
|
obj.click(); |
|
|
|
} |
|
|
|
|
|
|
|
var rct = obj.bounds(); |
|
|
|
click(rct.centerX() + rx, rct.centerY() + ry); |
|
|
|
click(rct.centerX() + rx, rct.centerY() + ry); |
|
|
|
click(rct.centerX() + rx, rct.centerY() + ry); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
auto(); |
|
|
|
sleep(1000); |
|
|
|
console.show(); |
|
|
|
function getById (maxIndex, name) { |
|
|
|
for (let index = 0; index < maxIndex; index++) { |
|
|
|
console.verbose(index, name); |
|
|
|
var t = id(name).findOnce(); |
|
|
|
if (t != undefined) |
|
|
|
return t; |
|
|
|
sleep(500); |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
for (var i = 1; i < 500; i++) { |
|
|
|
sleep(1000); |
|
|
|
console.log("下滑!") |
|
|
|
gesture(400, [520, 1550], [520, 450]); |
|
|
|
sleep(1000); |
|
|
|
var youth = id("ah5").className("android.widget.TextView").findOnce(1); |
|
|
|
var youth = id("ah5").className("android.widget.TextView").findOnce(0) |
|
|
|
|| id("a03").className("android.widget.LinearLayout").findOnce(0) |
|
|
|
|| id("ail").className("android.widget.TextView").findOnce(0); |
|
|
|
|
|
|
|
sleep(200); |
|
|
|
if (youth == undefined) |
|
|
|
youth = id("a03").className("android.widget.LinearLayout").findOnce(1); |
|
|
|
|
|
|
|
if (youth == undefined) { |
|
|
|
console.log(i, "未找到!") |
|
|
|
continue; |
|
|
|
} |
|
|
|
try { |
|
|
|
|
|
|
|
console.log(i, youth.text()); |
|
|
|
var youok = youth.bounds(); |
|
|
|
var a = youok.centerX(); |
|
|
|
var b = youok.centerY(); |
|
|
|
click(a, b); |
|
|
|
randomClickObject(youth); |
|
|
|
// var youok = youth.bounds();
|
|
|
|
// var a = youok.centerX();
|
|
|
|
// var b = youok.centerY();
|
|
|
|
// click(a, b);
|
|
|
|
sleep(1000); |
|
|
|
back(); |
|
|
|
var taskBtn = getById(2, 'cn.youth.news:id/x8'); |
|
|
|
if (taskBtn == undefined) |
|
|
|
back(); |
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |