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 for Firefox should be notified on Page events (load, console, domcontentloaded...)

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 0.4.2 (puppeteer-firefox)
  • Platform / OS version: Ubuntu 18.04.1 LTS
  • Node.js version: v10.14.1

What steps will reproduce the problem?

  1. Create a file named main.js with the following content:

main.js

const b = process.env.PUPPETEER_BROWSER || 'chrome'
const puppeteer = b === 'firefox' ?
  require('puppeteer-firefox') :
  require('puppeteer')

const path = require('path')

;(async function () {
  const browser = await puppeteer.launch();
  const page = await browser.newPage()
  page.on('load', () => console.log('load'))
  page.on('domcontentloaded', () => console.log('domcontentloaded'))
  page.on('console', () => console.log('console'))
  page.on('pageerror', () => console.log('pageerror'))
  await page.goto('file://' + path.join(__dirname, 'index.html'))
  await page.close();
  await browser.close();
})()
  1. Create a file named index.html with the following content:

index.html

<!DOCTYPE html>
<html>
<head>
  <title>Hello</title>
  <meta charset="utf-8"/>
</head>
<body>
<script>console.log('hello')</script>
</body>
</html>
  1. Run the script main.js against Chrome:
node main.js 
console
load
domcontentloaded

All good with puppeteer Chrome.

  1. Run the script main.js against Firefox
PUPPETEER_BROWSER=firefox node main.js
(empty)

What is the expected result?

First of all thanks for this amazing project! 😍 👏 Puppeteer for Firefox should trigger the following events and/or the Page should be notified:

  • console
  • load
  • domcontentloaded

I’m aware that Puppeteer for Firefox is experimental but the documentation page does list these events as “Supported API”: https://github.com/GoogleChrome/puppeteer/tree/master/experimental/puppeteer-firefox#readme

What happens instead?

No event was triggered 😐

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Mogzttercommented, Jan 24, 2019
0reactions
mjzffrcommented, Aug 3, 2020

This should work now with puppeteer + Firefox Nightly. If it’s still not working, feel free to reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Puppeteer for Firefox should be notified on Page events (load ...
Puppeteer for Firefox should trigger the following events and/or the Page should be notified: console; load; domcontentloaded.
Read more >
Puppeteer wait until page is completely loaded - Stack Overflow
What I want is to generate PDF report as soon as Page is loaded completely. I don't want to write any type of...
Read more >
Puppeteer documentation - DevDocs
Puppeteer is a Node library which provides a high-level API to control Chromium or Chrome over the DevTools Protocol. The Puppeteer API is...
Read more >
Getting to Know Puppeteer Using Practical Examples
We instruct Puppeteer to gather coverage information for JavaScript and CSS files, until the page is loaded. Thereafter, we define ...
Read more >
mozilla-release: changeset 551676 ...
remote/test/puppeteer/experimental/puppeteer-firefox/lib/Page.js ... Capture console output - You can listen for the `console` event.
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