puppeteer: Firefox: puppeteer never returns from page.goto() with file:// protocol

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 2.1.1
  • Platform / OS version: Linux
  • URLs (if applicable):
  • Node.js version: v12.16.1

What steps will reproduce the problem? If you run the following code, “GOTO” is logged in the console, but “After GOTO” is never reached. After closing the browser window manually, an error is logged: (node:4128451) UnhandledPromiseRejectionWarning: Error: Navigation failed because browser has disconnected!

const puppeteer = require('puppeteer');
global.page = undefined;

(async function(){
  const browser = (await puppeteer.launch({
    product: 'firefox',
    executablePath: '/opt/firefox/firefox',
    headless: false,
    devtools: false,
    defaultViewport: {
      width: 1000,
      height: 0,
      deviceScaleFactor: 2
    }
  }));
  global.page = (await browser.pages())[0];
  console.log("GOTO");
  await page.goto("file://" + process.cwd() + "/dist");
  console.log("After GOTO");

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

If you remove the product and executablePath, it works fine with chrome, it logs

GOTO
After GOTO

and then closes the browser window again.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 16 (2 by maintainers)

Most upvoted comments

@m90 that’s exactly what I’m doing right now, gave up trying to use puppeteer with firefox. Thanks.

If someone has any workarounds, please let us know.

@jlcd I ported my project to Playwright by now because of this limitation. Works flawlessly using both engines by now.