查找所有 (Node.find_all)
Node.find_all
声明
child_nodes = node:find_all(selector)
参数
| 参数 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| selector | Selector | 是 | 控件选择器 |
返回值
| 类型 | 说明 |
|---|---|
| table | 控件对象列表 |
说明
在此控件的子控件中继续查找,返回满足条件的所有控件。
待实现
该接口正在开发中。
示例
local node = require("node")
local n = node.selector():id("com.example:id/container"):type("FrameLayout"):find()
if n then
-- 在 node 控件中查找它的所有孩子控件
local nchilds = node:find_all(node.selector():child())
if nchilds then
for _, nchild in ipairs(nchilds) do
print(nchild)
end
end
end
AScript 对应
# AScript (Python)
from ascript.android.node import Selector
node = Selector().id("com.aojoy.airscript:id/search_query_section").type("FrameLayout").find()
if node:
nchilds = node.find_all(Selector().child())
if nchilds:
for nchild in nchilds:
print(nchild)