菜单
文档breadcrumb arrow Grafana k6breadcrumb arrow JavaScript APIbreadcrumb arrow k6/browserbreadcrumb arrow Framebreadcrumb arrow isEnabled(selector[, options])
开源

isEnabled(selector[, options])

警告

请改用基于定位器的 locator.isEnabled([options]) 方法。

检查元素是否处于 启用 状态。

参数类型默认值描述
selectorstring''用于查找元素的选择器。如果存在多个满足选择器的元素,将使用第一个。
optionsobjectnull
options.strictbooleanfalse当设置为 true 时,要求选择器只能匹配到一个元素。如果给定的选择器匹配到多个元素,则会抛出异常。
options.timeoutnumber30000最大超时时间,单位毫秒。传入 0 可禁用超时。默认值会被 BrowserContextPage 上的 setDefaultTimeout 选项覆盖。

返回值

类型描述
Promise<bool>一个 Promise,如果元素处于 启用 状态,则解析为 true,否则解析为 false