Skip to content

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

fix: allow email type in input for fill action (#353)

Arjun Attam682e2be15f4e
diff --git a/src/input.ts b/src/input.ts
index a3e23d2a4f..ba09a04485 100644
--- a/src/input.ts
+++ b/src/input.ts
@@ -339,7 +339,7 @@ export const fillFunction = (node: Node) => {
if (element.nodeName.toLowerCase() === 'input') {
const input = element as HTMLInputElement;
const type = input.getAttribute('type') || '';
- const kTextInputTypes = new Set(['', 'password', 'search', 'tel', 'text', 'url']);
+ const kTextInputTypes = new Set(['', 'email', 'password', 'search', 'tel', 'text', 'url']);
if (!kTextInputTypes.has(type.toLowerCase()))
return 'Cannot fill input of type "' + type + '".';
if (input.disabled)
diff --git a/test/page.spec.js b/test/page.spec.js
index 24365b9af3..fed7d988a7 100644
--- a/test/page.spec.js
+++ b/test/page.spec.js
@@ -977,7 +977,7 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
});
it('should throw on non-text inputs', async({page, server}) => {
await page.goto(server.PREFIX + '/input/textarea.html');
- for (const type of ['email', 'number', 'date']) {
+ for (const type of ['color', 'number', 'date']) {
await page.$eval('input', (input, type) => input.setAttribute('type', type), type);
let error = null;
await page.fill('input', '').catch(e => error = e);