From 5c1f7cfb0cd9e272b3c2386e5429da5e4e6e05e8 Mon Sep 17 00:00:00 2001 From: Arjun Attam Date: Tue, 7 Jan 2020 13:57:17 -0800 Subject: [PATCH] fix(fill): use HTMLInputElement.select (#406) --- src/dom.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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;