diff --git a/packages/puppeteer-core/src/api/locators/Locator.ts b/packages/puppeteer-core/src/api/locators/Locator.ts index ede9449877e..32d3f4e2dc4 100644 --- a/packages/puppeteer-core/src/api/locators/Locator.ts +++ b/packages/puppeteer-core/src/api/locators/Locator.ts @@ -476,6 +476,9 @@ export abstract class Locator extends EventEmitter { if (el instanceof HTMLSelectElement) { return 'select'; } + if (el instanceof HTMLTextAreaElement) { + return 'typeable-input'; + } if (el instanceof HTMLInputElement) { if ( new Set([ diff --git a/test/src/locator.spec.ts b/test/src/locator.spec.ts index 30c11308fa9..abab4aeb720 100644 --- a/test/src/locator.spec.ts +++ b/test/src/locator.spec.ts @@ -370,7 +370,28 @@ describe('Locator', function () { }); }); - describe('Locator.change', function () { + describe('Locator.fill', function () { + it('should work for textarea', async () => { + const {page} = await getTestState(); + + await page.setContent(` + + `); + let filled = false; + await page + .locator('textarea') + .on(LocatorEmittedEvents.Action, () => { + filled = true; + }) + .fill('test'); + expect( + await page.evaluate(() => { + return document.querySelector('textarea')?.value === 'test'; + }) + ).toBe(true); + expect(filled).toBe(true); + }); + it('should work for selects', async () => { const {page} = await getTestState();