launchApp("百度贴吧");
text("进吧").waitFor();
//底部导航栏
var bottomNav = id("com.baidu.tieba:id/tabcontainer_wrapper").untilFindOne();
//进吧
var enter = bottomNav.child(1).child(1);
//点击切换到进吧
click(enter.bounds().centerX(), enter.bounds().centerY());
sleep(500);
//贴吧等级图标或是贴吧名称
var grades = id("com.baidu.tieba:id/grade").find();
if (grades) {
grades.each(function (grade) {
var myFollow = grade.parent();
if (myFollow.childCount() == 2) { //贴吧名称+等级2个子元素
click(myFollow.bounds().centerX(), myFollow.bounds().centerY());
signIn();
} else {
//贴吧名称+签到标识+等级3个子元素
var tiebaName = myFollow.child(0).text();
toast(tiebaName + "吧已签到")
}
sleep(1500);
});
} else {
toast("没有关注的贴吧");
}
sleep(500);
//切换的到主页
var index = bottomNav.child(1).child(0);
//点击切换到进吧
click(index.bounds().centerX(), index.bounds().centerY());

function signIn() {
// text("签到").waitFor();
var sign = id("com.baidu.tieba:id/tv_sign").desc("签到").untilFindOne();
sleep(500);
if (sign.text() == "签到") {
//开始签到
click(sign.bounds().centerX(), sign.bounds().centerY());
sleep(500);
toast("签到成功");
} else {
toast("此吧今日已签到");
}
// 返回
sleep(500);
var backBtn = id("com.baidu.tieba:id/widget_navi_back_button").desc("返回").untilFindOne();
click(backBtn.bounds().centerX(), backBtn.bounds().centerY());
}

  • 3
    帖子
  • 747
    浏览

与 Auto.js 的连接断开,我们正在尝试重连,请耐心等待