evaluateOnNewDocument is broken on firefox
See original GitHub issueSteps 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?
- 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:
- Created 3 years ago
- Reactions:3
- Comments:10 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@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.
The corresponding protocol-level work in Firefox is tracked at https://bugzilla.mozilla.org/show_bug.cgi?id=1601695