Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

Arjun Attam5c1f7cfb0cd9
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<T extends Node = Node> extends js.JSHandle<T> {
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;