waitForEnabled

abstract fun waitForEnabled(scope: CoroutineScope, xpath: String, timeout: Long): Deferred<Boolean>

等待指定 XPath 的元素变为可用状态(即 disabled 属性为 false)。

此方法会持续检测元素,直到满足以下条件或超时:

  1. 元素存在于 DOM 中。

  2. 元素的 disabled 属性为 false。

Return

Deferred<Boolean>:如果在超时前元素变为可用,返回 true;否则返回 false。

Parameters

scope

用于执行异步操作的 CoroutineScope

xpath

目标元素的 XPath 路径。

timeout

最大等待时间(毫秒)。