Locator.fill() 方法
¥Locator.fill() method
使用提供的值填写定位器标识的输入。输入的类型在运行时确定,并根据类型选择适当的填充方法。支持 contenteditable
、select、textarea 和 input 元素。
¥Fills out the input identified by the locator using the provided value. The type of the input is determined at runtime and the appropriate fill-out method is chosen based on the type. contenteditable
, select, textarea and input elements are supported.
签名
¥Signature
class Locator {
fill<ElementType extends Element>(
this: Locator<ElementType>,
value: string,
options?: Readonly<ActionOptions>
): Promise<void>;
}
参数
¥Parameters
范围 | 类型 | 描述 |
---|---|---|
this | 定位器<元素类型> | |
value | string | |
options | 只读<ActionOptions> | (可选的) |
Returns:
Promise<void>