Last active
February 25, 2024 08:12
-
-
Save seozed/eb53bf3f2c51b1d844856bbbfc4f695d to your computer and use it in GitHub Desktop.
[example-for-autojs] #autojs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var list = className("AbsListView").findOne(); | |
for(var i = 0; i < list.childCount(); i++){ | |
var child = list.child(i); | |
log(child.className()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.show(); | |
className("TextView").find().forEach(function(tv){ | |
if(tv.text() != ""){ | |
log(tv.text()); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//找出动态列表 | |
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