Locator.fill() 方法
使用提供的值填写定位器标识的输入。输入的类型在运行时确定,并根据类型选择合适的填写方法。支持 contenteditable、select、textarea 和 input 元素。对于复选框、单选按钮和开关,请指定布尔值。
签名
class Locator {
fill<ElementType extends Element>(
this: Locator<ElementType>,
value: string | boolean,
options?: Readonly<LocatorFillOptions>,
): Promise<void>;
}
参数
|
参数 |
类型 |
说明 |
|---|---|---|
|
this |
Locator<ElementType> | |
|
value |
string | boolean | |
|
options |
Readonly<LocatorFillOptions> |
(可选) |
返回值:
Promise<void>