fix(fill): use HTMLInputElement.select (#406)

This commit is contained in:
Arjun Attam 2020-01-07 13:57:17 -08:00 committed by Yury Semikhatsky
parent f75ac45c42
commit 5c1f7cfb0c

View File

@ -366,8 +366,7 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
return 'Cannot fill a disabled input.'; return 'Cannot fill a disabled input.';
if (input.readOnly) if (input.readOnly)
return 'Cannot fill a readonly input.'; return 'Cannot fill a readonly input.';
input.selectionStart = 0; input.select();
input.selectionEnd = input.value.length;
input.focus(); input.focus();
} else if (element.nodeName.toLowerCase() === 'textarea') { } else if (element.nodeName.toLowerCase() === 'textarea') {
const textarea = element as HTMLTextAreaElement; const textarea = element as HTMLTextAreaElement;