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.

evaluateOnNewDocument is broken on firefox

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 5.0.0 (and 3.3.0)
  • Platform / OS version: MacOS 10.15.5
  • Node.js version: v12.14.0

What steps will reproduce the problem?

  1. Run this code
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({
    product: 'firefox',
  });
  const page = await browser.newPage();
  await page.evaluateOnNewDocument(() => {
    window.addEventListener('DOMContentLoaded', () => console.log('Loaded!'));
  });
  page.on('console', (msg) => console.log(msg.text()));
  await page.goto('http://example.com');

  await browser.close();
})();

What is the expected result? Print Loaded!on console.

What happens instead? It doesn’t print Loaded!

Note: It works on chrome.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mjzffrcommented, Jul 7, 2020

@elharrak-bouygues That’s right, Firefox support is still experimental. I’m not aware of a specific timeline, but this part of the protocol has a higher priority than other features.

1reaction
mjzffrcommented, Jul 7, 2020

The corresponding protocol-level work in Firefox is tracked at https://bugzilla.mozilla.org/show_bug.cgi?id=1601695

Read more comments on GitHub >

github_iconTop Results From Across the Web

Selenium webdriver: firefox headless inject javascript to ...
I found the solution to the problem by following this post. In few words, by using an extensions it is possible to inject...
Read more >
mozilla-release: changeset 564654 ... - Mercurial
*label* is one of the following: - `fix` - puppeteer bug fixes. ... on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.
Read more >
Use evaluateOnNewDocument in Puppeteer With Examples
Learn how to use evaluateOnNewDocument function in Puppeteer framework for your next JavaScript automation project with LambdaTest Automation Testing ...
Read more >
JavaScript Injection with Selenium, Puppeteer, and Marionette ...
An exploration of different browser automation methods to inject JavaScript into webpages.
Read more >
Puppeteer | Puppeteer
Capture a timeline trace of your site to help diagnose performance issues. ... You can also use Puppeteer with Firefox Nightly (experimental support)....
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