File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -1012,6 +1012,8 @@ const fs = require('fs');
1012
1012
This method focuses the element and triggers an ` input ` event after filling.
1013
1013
If there's no text ` <input> ` , ` <textarea> ` or ` [contenteditable] ` element matching ` selector ` , the method throws an error.
1014
1014
1015
+ > ** NOTE** Pass empty string as a value to clear the input field.
1016
+
1015
1017
Shortcut for [ page.mainFrame().fill()] ( #framefillselector-value )
1016
1018
1017
1019
#### page.focus(selector, options)
Original file line number Diff line number Diff line change @@ -414,7 +414,10 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
414
414
} , value ) ;
415
415
if ( error )
416
416
throw new Error ( error ) ;
417
- await this . _page . keyboard . sendCharacters ( value ) ;
417
+ if ( value )
418
+ await this . _page . keyboard . sendCharacters ( value ) ;
419
+ else
420
+ await this . _page . keyboard . press ( 'Delete' ) ;
418
421
}
419
422
420
423
async setInputFiles ( ...files : ( string | types . FilePayload ) [ ] ) {
You can’t perform that action at this time.
0 commit comments