diff --git a/src/dom.ts b/src/dom.ts index dd6ceabb1a..cc16cf659c 100644 --- a/src/dom.ts +++ b/src/dom.ts @@ -366,8 +366,7 @@ export class ElementHandle extends js.JSHandle { return 'Cannot fill a disabled input.'; if (input.readOnly) return 'Cannot fill a readonly input.'; - input.selectionStart = 0; - input.selectionEnd = input.value.length; + input.select(); input.focus(); } else if (element.nodeName.toLowerCase() === 'textarea') { const textarea = element as HTMLTextAreaElement;