setAttribute

abstract fun setAttribute(scope: CoroutineScope, xpath: String, attributeName: String, value: String): Deferred<Boolean>

异步设置由 XPath 指定的元素的 HTML 属性 (Attribute) 值。

Return

一个 Deferred<Boolean>,如果成功设置则为 true,否则为 false

Parameters

scope

用于执行此操作的协程作用域。

xpath

目标元素的 XPath。

attributeName

属性名称(例如 "class", "style", "src")。

value

要设置的字符串值。