查找多个 UI 元素 (ui_element.find_all)
该函数在 20260507 以后版本方可使用
声明
元素列表 = ui_element.find_all(选择器 [, 选项 ])
参数
返回值
- 元素列表 表型,所有匹配元素组成的数组。没有匹配项时返回空数组。
说明
find_all适合枚举同类控件或先检查匹配数量。 如果只需要第一个匹配项,使用find更直接。
示例
local ui_element = require("ui_element")
local items = ui_element.find_all({
role = "button",
})
for i, item in ipairs(items) do
nLog(i, item.text or "")
end
注:上述代码中使用了非本章函数 nLog