fix(test): properly clean input field (#860)
This commit is contained in:
parent
fa6a5edb31
commit
a72784a677
|
|
@ -1012,6 +1012,8 @@ const fs = require('fs');
|
||||||
This method focuses the element and triggers an `input` event after filling.
|
This method focuses the element and triggers an `input` event after filling.
|
||||||
If there's no text `<input>`, `<textarea>` or `[contenteditable]` element matching `selector`, the method throws an error.
|
If there's no text `<input>`, `<textarea>` or `[contenteditable]` element matching `selector`, the method throws an error.
|
||||||
|
|
||||||
|
> **NOTE** Pass empty string as a value to clear the input field.
|
||||||
|
|
||||||
Shortcut for [page.mainFrame().fill()](#framefillselector-value)
|
Shortcut for [page.mainFrame().fill()](#framefillselector-value)
|
||||||
|
|
||||||
#### page.focus(selector, options)
|
#### page.focus(selector, options)
|
||||||
|
|
|
||||||
|
|
@ -414,7 +414,10 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
|
||||||
}, value);
|
}, value);
|
||||||
if (error)
|
if (error)
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
await this._page.keyboard.sendCharacters(value);
|
if (value)
|
||||||
|
await this._page.keyboard.sendCharacters(value);
|
||||||
|
else
|
||||||
|
await this._page.keyboard.press('Delete');
|
||||||
}
|
}
|
||||||
|
|
||||||
async setInputFiles(...files: (string | types.FilePayload)[]) {
|
async setInputFiles(...files: (string | types.FilePayload)[]) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue