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.

Puppeteer 3.3.0 crashes Firefox Nightly 79 when using UTF8 in ElementHandler.type

See original GitHub issue

Consider the following script

const puppeteer = require( "puppeteer" );

async function main() {
  try {
    const browser = await puppeteer.launch({
      "product": "firefox",
      "headless": false,
      "devtools": false,
      "slowMo": 30,
      "ignoreHTTPSErrors": true,
      "executablePath": "/etc/firefox-nightly/firefox"
    });
    const page = await browser.newPage();
    await page.goto( "http://todomvc.com/examples/react/#/" );
    const elh = await page.$( "input.new-todo" );
    await elh.type( "ưxx111" );
   
    await browser.close();
  } catch ( e ) {
    console.error( e );
  }

}
main();

If I use in await elh.type( "abc" ); any ASCII everything works perfect, but with "ưxx111" it crashes Firefox with fatal error:

chrome://remote/content/sessions/frame-script.js:12:1

    at Promise (/tmp/node_modules/puppeteer/lib/Connection.js:152:63)
    at new Promise (<anonymous>)
    at CDPSession.send (/tmp/node_modules/puppeteer/lib/Connection.js:151:16)
    at Keyboard.sendCharacter (/tmp/node_modules/puppeteer/lib/Input.js:105:28)
    at Keyboard.<anonymous> (/tmp/node_modules/puppeteer/lib/helper.js:95:27)
    at Keyboard.type (/tmp/node_modules/puppeteer/lib/Input.js:119:28)
    at Keyboard.<anonymous> (/tmp/node_modules/puppeteer/lib/helper.js:95:27)
    at ElementHandle.type (/tmp/node_modules/puppeteer/lib/JSHandle.js:307:35)
  -- ASYNC --
    at ElementHandle.<anonymous> (/tmp/node_modules/puppeteer/lib/helper.js:94:19)
    at main (/tmp/test.js:16:15)
  message:
   'Protocol error (Input.insertText): Input.insertText RemoteAgentError@chrome://remote/content/Error.jsm:25:5\n
UnknownMethodError@chrome://remote/content/Error.jsm:108:7\n
execute@chrome://remote/content/domains/DomainCache.jsm:96:13\n
receiveMessage@chrome://remote/content/sessions/ContentProcessSession.jsm:86:45\n
MessageListener.receiveMessage*ContentProcessSession@chrome://remote/content/sessions/ContentProcessSession.jsm:33:25\n
@chrome://remote/content/sessions/frame-script.js:12:1\n' }

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
victorgseocommented, Jun 22, 2021

A quick solution is to add into “/puppeteer/lib/cjs/puppeteer/common/USKeyboardLayout.js” the chars you’ll use.

For example, for “ê”, append the line to main object:

ê: { keyCode: 234, key: 'ê', code: 'KeyÊ' },

Run this function to generate and paste into the USKeyboardLayout.js:

function charcodes(char) {

return `${char}: { keyCode: ${char.charCodeAt(0)}, key: '${char}', code: 'Key${char.toUpperCase()}' },`

}

for(let each of ‘êÊáéíúó’){ console.log(charcodes(each)) }

Hope it helps 😃

0reactions
stale[bot]commented, Jul 24, 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 causes Firefox to freeze because stdout/stderr ...
It simply loads the given page, and then quits the browser. But closing the browser hangs, and Firefox never quits. Even the shutdown...
Read more >
Puppeteer crashes on browser.close() with: Received signal ...
Same issue. appears to happen only on .close() and the rest of the process runs fine. there are some errors on launch but...
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