question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: page.type in Puppeteer with Firefox stops at/can't type certain characters (Input.insertText not implemented)

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 2.1.1
  • Platform / OS version: Microsoft Windows 10 Education (Version 10.0.17134 Build 17134)
  • URLs (if applicable): doesn’t seem to be specific to URL
  • Node.js version: v12.16.1
  • Firefox Nightly version: 77.0a1 (2020-04-11) (64-Bit)

What steps will reproduce the problem? Running Puppeteer with Firefox and using page.type with certain characters, for example German Umlauts. In general it seems like characters with utf8 hex code greater than 007E resp. 007F are not working.

Minimal code example that has the problem:

const puppeteer = require('puppeteer');

const options = {
  executablePath: 'C:\\Program Files\\Firefox Nightly\\firefox.exe',
  headless:false, 
  slowMo:10,
  defaultViewport: null,
  product:'firefox',
  args: [
  "-wait-for-browser",
  ],
};

puppeteer.launch(options).then(async browser => {
  const page = await browser.newPage();
  await page.goto('https://www.web.de');
  await page.waitFor(3000);
  let myString = 'Tokyo street \u007E \u00A1 ä \uc3a4 👹';
  await page.type("#freemailLoginUsername", myString);
  await page.waitFor(999999);
})

What is the expected result? The characters get typed by page.type.

What happens instead? The typing is stopped at the first character that causes a problem and in the console the following message is printed:

(node:45516) UnhandledPromiseRejectionWarning: Error: Protocol error (Input.insertText): Input.insertText RemoteAgentError@chrome://remote/content/Error.jsm:25:5
UnknownMethodError@chrome://remote/content/Error.jsm:108:7
execute@chrome://remote/content/domains/DomainCache.jsm:96:13
receiveMessage@chrome://remote/content/sessions/ContentProcessSession.jsm:69:45
MessageListener.receiveMessage*ContentProcessSession@chrome://remote/content/sessions/ContentProcessSession.jsm:27:25
@chrome://remote/content/sessions/frame-script.js:12:1

    at C:\Users\Veri\node_modules\puppeteer\lib\Connection.js:183:56
    at new Promise (<anonymous>)
    at CDPSession.send (C:\Users\Veri\node_modules\puppeteer\lib\Connection.js:182:12)
    at Keyboard.sendCharacter (C:\Users\Veri\node_modules\puppeteer\lib\Input.js:151:24)
    at Keyboard.<anonymous> (C:\Users\Veri\node_modules\puppeteer\lib\helper.js:112:23)
    at Keyboard.type (C:\Users\Veri\node_modules\puppeteer\lib\Input.js:166:20)
    at async ElementHandle.type (C:\Users\Veri\node_modules\puppeteer\lib\JSHandle.js:363:5)
    at async DOMWorld.type (C:\Users\Veri\node_modules\puppeteer\lib\DOMWorld.js:422:5)
    at async C:\Users\Veri\Documents\Webdesign\KleinanzeigenAuto\Scripts\testCharacterFirefox.js:19:3
  -- ASYNC --
    at Keyboard.<anonymous> (C:\Users\Veri\node_modules\puppeteer\lib\helper.js:111:15)
    at ElementHandle.type (C:\Users\Veri\node_modules\puppeteer\lib\JSHandle.js:363:31)
    at async DOMWorld.type (C:\Users\Veri\node_modules\puppeteer\lib\DOMWorld.js:422:5)
    at async C:\Users\Veri\Documents\Webdesign\KleinanzeigenAuto\Scripts\testCharacterFirefox.js:19:3
  -- ASYNC --
    at ElementHandle.<anonymous> (C:\Users\Veri\node_modules\puppeteer\lib\helper.js:111:15)
    at DOMWorld.type (C:\Users\Veri\node_modules\puppeteer\lib\DOMWorld.js:422:18)
    at async C:\Users\Veri\Documents\Webdesign\KleinanzeigenAuto\Scripts\testCharacterFirefox.js:19:3
  -- ASYNC --
    at Frame.<anonymous> (C:\Users\Veri\node_modules\puppeteer\lib\helper.js:111:15)
    at Page.type (C:\Users\Veri\node_modules\puppeteer\lib\Page.js:1103:29)
    at C:\Users\Veri\Documents\Webdesign\KleinanzeigenAuto\Scripts\testCharacterFirefox.js:19:14
(node:45516) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:45516) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

With Chromium everything works as expected, as these issues with it have already been fixed (for example issue #1096)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
hienvuong2810commented, May 25, 2021

I solved this problem. You should click this element before typing.

await page.type("#input", "hello")

Should

await page.click("#input")
await page.type("#input", "hello")
0reactions
stale[bot]commented, Jul 25, 2022

We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Puppeteer input not typing all characters - Stack Overflow
There is an open github issue on this bug:https://github.com/puppeteer/puppeteer/issues/1648. Meanwhile you can do the following workaround:
Read more >
1552326 - Implement Network.setRequestInterception
See bug 1552325 comment 0. This command enables the emission of Network.requestIntercepted event, which looks like this: {"method":"Network.
Read more >
Puppeteer-firefox - npm.io
This project is a feasibility prototype to guide the work of implementing Puppeteer endpoints into Firefox's code base. Mozilla's bug 1545057 tracks the ......
Read more >
1164757 - Capture full size screenshot is broken - Monorail
5. Type "Capture full size screenshot" then press ENTER 6. Take note of the resulting image pixel dimensions (1009 x 2718) 7. Open...
Read more >
How to Run Puppeteer with Firefox Instead of Chrome
It is commonly used by developers to automate the browser to run website tests. ... Next, let's write some code to run Puppeteer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found