Hi I am doing some web automation. I am trying to open a url and I am getting a data URL error in chrome console so I am moving to firefox console to get around the no data urls opening in the chrome console issue. The problem is “npm install puppeteer-firefox” is not working to install puppeteer for firefox. How can I install puppeteer for firefox and include it in the code so I can use it?
Code not working in chrome because of data url error
const url = await page.evaluate(async () => { document.querySelector('.n3VNCb').src; }); url.toString(); await page.goto(url);
What I typed into node.js command prompt to install puppeteer firefox. This did not work
npm i puppeteer-firefox
Error I received from the node.js command prompt
npm WARN deprecated puppeteer-firefox@0.5.1: Firefox support is gradually transitioning to the puppeteer package. As of puppeteer v2.1.0 you can interact with Firefox Nightly. The puppeteer-firefox > package will remain available until the transition is complete, but it is no longer actively maintained. For more information visit https://wiki.mozilla.org/Remote
puppeteer-firefox@0.5.1 install C:UsersuserDesktopfilenamefilenamenode_modulespuppeteer-firefox node install.js
ERROR: Failed to download Firefox rv0.0.1! Error: Download failed: server returned code 404. URL: https://github.com/puppeteer/juggler/releases/download/v0.0.1/firefox-win64.zip
I also tried these as an error said to do and they did not work
(node:14348) UnhandledPromiseRejectionWarning: Error: Could not find browser revision latest. Run “PUPPETEER_PRODUCT=firefox npm install” or “PUPPETEER_PRODUCT=firefox yarn install” to download a supported Firefox browser binary.
PUPPETEER_PRODUCT=firefox npm install
PUPPETEER_PRODUCT=firefox yarn install
Advertisement
Answer
I had a similar issue, the command you have to run is actually the following:
PUPPETEER_PRODUCT=firefox npm i puppeteer
Source : https://github.com/puppeteer/puppeteer/blob/v5.2.1/docs/api.md#puppeteerlaunchoptions