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 NOT working with Firefox (nightly) when {product: 'firefox'}

See original GitHub issue

Steps to reproduce

  1. Download Firefox Nightly
  2. Run the below edited example to use product: 'firefox'
/**
 * @name Duck Duck Go search
 */

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({
	  headless: false,
	  product: 'firefox',
	  //executablePath: 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe'
	  //executablePath: 'C:/Program Files/Mozilla Firefox/firefox.exe'
	  executablePath: 'C:/Program Files/Firefox Developer Edition/firefox.exe',
	  dumpio: true

	  });
  const page = await browser.newPage()
  await page.goto('https://duckduckgo.com/')  
  await page.type('#search_form_input_homepage', 'Puppeteer')
  const searchValue = await page.$eval('#search_form_input_homepage', el => el.value)
  console.log(searchValue)
  await browser.close()
})()

Tell us about your environment:

  • Puppeteer version: 3.2.0
  • Platform / OS version: Windows 10
  • URLs (if applicable):
  • Node.js version: v13.8.0
  • NPM version: 6.14.2

What steps will reproduce the problem? Described above

What is the expected result? Puppeteer to work as expected, the same way (or near) as it works with chrome/chromium

What happens instead? It crash with:

C:\Users\Milen\Desktop\Puppeteer-Test_Firefox>node test.js
(node:12256) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!


TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (C:\Users\Milen\Desktop\Puppeteer-Test_Firefox\node_modules\puppeteer\lib\Launcher.js:750:14)
    at ChildProcess.<anonymous> (C:\Users\Milen\Desktop\Puppeteer-Test_Firefox\node_modules\puppeteer\lib\Launcher.js:740:61)
    at ChildProcess.emit (events.js:333:22)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
(node:12256) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12256) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[Error: EBUSY: resource busy or locked, unlink 'C:\Users\Milen\AppData\Local\Temp\puppeteer_dev_firefox_profile-BFNrfA\cookies.sqlite'] {
  errno: -4082,
  code: 'EBUSY',
  syscall: 'unlink',
  path: 'C:\\Users\\Milen\\AppData\\Local\\Temp\\puppeteer_dev_firefox_profile-BFNrfA\\cookies.sqlite'
}

and the Firefox Nightly is left open: изображение About was additionali clicked in order to see the version.

Can you please someone review it and advise what might be the issue.

Thank you,

Milen Palavrov

Issue Analytics

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

github_iconTop GitHub Comments

14reactions
mpalavrovcommented, Jun 13, 2020

Just for whoever is having this issue. The fix for my troubles are…:

/**
 * @name Duck Duck Go search
 */

const puppeteer = require('puppeteer-core');

(async () => {
  const browser = await puppeteer.launch({
	  headless: true,
	  product: 'firefox',
	  args: [
	  '-wait-for-browser'
	  ],
	  executablePath: 'C:/Program Files/Firefox Nightly/firefox.exe',
		userDataDir: 'C:/Users/Milen/Desktop/Puppeteer-Test_Firefox/Profile_FirefoxNightly',
	  });

  const page = await browser.newPage()
  	
  //await page.goto('https://duckduckgo.com/')  
      await page.setViewport({ width: 1920, height: 1080 });
   await page.screenshot({path: 'example.png'});
  await browser.close()
})()

There were 2 issues with my code:

  1. I was using Firefox Developers 🔴 instead of Firefox Nightly 🟢 , which seems to be an issue.
  2. I have added
	  args: [
	  '-wait-for-browser'
	  ],

Which seems to be needed when using Firefox.

Cheers guys, I hope it helps someone.

Closing.

0reactions
mjzffrcommented, Jul 30, 2020

Thanks for sharing your solution 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Run Puppeteer with Firefox Instead of Chrome
As puppeteer is already added to package.json , we can run npm i . The latest version of Firefox Nightly should be downloaded...
Read more >
how do you install and run puppeteer for firefox - Stack Overflow
Personally had a problem with Puppeteer. Can't install it on ubuntu. Just empty .local-firefox. Playwright has webkit, chromium and firefox ...
Read more >
Puppeteer causes Firefox to freeze because stdout/stderr ...
Puppeteer causes Firefox to freeze because stdout/stderr pipes are no longer processed.
Read more >
How to run Tests in Puppeteer with Firefox - BrowserStack
Due to high demand from users, Puppeteer extended its support to Firefox. However, Puppeteer Firefox support is still in the experimental stage, ...
Read more >
FAQ | Puppeteer
From Puppeteer v2.1.0 onwards you can specify puppeteer.launch({product: 'firefox'}) to run your Puppeteer scripts in Firefox Nightly, ...
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