Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望可以支持 UiObject 后再 findone查找 #2

Open
diuchouni opened this issue Mar 19, 2024 · 1 comment
Open

希望可以支持 UiObject 后再 findone查找 #2

diuchouni opened this issue Mar 19, 2024 · 1 comment

Comments

@diuchouni
Copy link

//找出动态列表
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();
}
});
例子

@1754048656
Copy link
Owner

// 案例1:
UiCollection collection = text("xxx").find(); // 查找全部 text = "xxx"的节点
// 对查找到的集合进行条件过滤,根据item 继续往下按条件查找 id = "ttt"
UiObject uiObject = collection.filterOne(item -> id("ttt").findOne(item).exists());

// 案例2:
UiObject uiObj1 = text("xxx").findOne();
UiObject uiObj2 = id("ttt").findOne(uiObj1.node); // 将上一个 node 作为参数传入 findOne(node) 即可

截屏2024-03-20 10 35 07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants