Brady Dowling
Brady Dowling

Reputation: 5522

Playwright fails to fill input

I'm running a Playwright script on a Jenkins page that has input elements. When I try to fill one of the inputs with text, it fails with this error:

(node:3337) UnhandledPromiseRejectionWarning: page.fill: Protocol error (Page.insertText): error in channel "content::page": exception while running method "insertText" in namespace "page": Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsITextInputProcessor.commitCompositionWith] _insertText@chrome://juggler/content/content/PageAgent.js:891:32

I've tried running with DEBUG=pw:api environment enabled but the logs there aren't too helpful. From the normal console log I get the following log:

waiting for selector "input[name="_.buildNumber"]"
  selector resolved to visible <input value="" type="text" name="_.buildNumber" class=…/>
elementHandle.fill("54")
  waiting for element to be visible, enabled and editable
  element is visible, enabled and editable

So it seems like the element exists and can be edited but for some reason Playwright is unsuccessful at trying to fill it. What am I missing here?

Upvotes: 6

Views: 7054

Answers (1)

Brady Dowling
Brady Dowling

Reputation: 5522

This is a Playwright bug that is specific to Firefox. To get around it for now, you should be able to switch to using either Chrome or Safari in your import statement. So either:

import { chromium } from 'playwright';

Or using Safari:

import { webkit } from 'playwright';

Upvotes: 1

Related Questions