Skip to content

Instantly share code, notes, and snippets.

@seozed
Last active February 25, 2024 08:12
Show Gist options
  • Save seozed/eb53bf3f2c51b1d844856bbbfc4f695d to your computer and use it in GitHub Desktop.
Save seozed/eb53bf3f2c51b1d844856bbbfc4f695d to your computer and use it in GitHub Desktop.
[example-for-autojs] #autojs
var list = className("AbsListView").findOne();
for(var i = 0; i < list.childCount(); i++){
var child = list.child(i);
log(child.className());
}
console.show();
className("TextView").find().forEach(function(tv){
if(tv.text() != ""){
log(tv.text());
}
});
//找出动态列表
var list = id("recycler_view").findOne();
//遍历动态
list.children().forEach(function(child){
//找出点赞图标
var like = child.findOne(id("feed_action_view_like"));
//找出点赞数量
var likeCount = child.findOne(id("text_view"));
//如果这两个控件没有找到就不继续了
if(like == null || likeCount == null){
return;
}
//判断点赞数量是否小于10
if(parseInt(likeCount.text()) < 10){
//点赞
like.click();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment