跳到主要内容

路径约束 (Selector.path)

Selector.path

声明

node.selector():path(val)

参数

参数类型是否必填说明
valstring控件路径,支持正则表达式

返回值

类型说明
Selector返回控件查找器,用于链式编程

说明

通过控件路径约束。

待实现

该接口正在开发中。

示例

local node = require("node")

-- 查找指定路径的控件
local n = node.selector():path("/FrameLayout/LinearLayout/FrameLayout/EditText"):find()

if n then
print(node)
else
print("没有找到任何控件")
end

AScript 对应

# AScript (Python)
from ascript.android.node import Selector

node = Selector().path("/FrameLayout/LinearLayout/FrameLayout/EditText").find()