Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Puppeteer not launching chromium in Mac 10.14

I am trying to open a page through puppeteer but it's not throwing any error and entire code is getting executed by chromium doesn't show up.

const puppeteer = require('puppeteer');

(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
console.log('there');
await page.goto('https://google.com');
console.log('yes');
//   await page.screenshot({path: 'example.png'});

//   await browser.close();
})();
like image 913
Akash Verma Avatar asked Nov 19 '18 07:11

Akash Verma


People also ask

Does puppeteer install Chromium?

When you install Puppeteer, it automatically downloads a recent version of Chromium (~170MB macOS, ~282MB Linux, ~280MB Windows) that is guaranteed to work with Puppeteer. For a version of Puppeteer without installation, see puppeteer-core .

Can puppeteer use Chrome instead of Chromium?

(However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the executablePath option to puppeteer. launch .

Does puppeteer work with Chrome?

Puppeteer is a Node library which provides a high-level API to control headless Chrome or Chromium over the DevTools Protocol. It can also be configured to use full (non-headless) Chrome or Chromium.


1 Answers

Quote from the Puppeteer documentation:

Puppeteer launches Chromium in headless mode. To launch a full version of Chromium, set the 'headless' option when launching a browser:

const browser = await puppeteer.launch({headless: false}); // default is true

“Headless” means when your code is executed, you won't actually see any browser window, the code is run in the browser purely on the command line.

like image 152
Patrick Hund Avatar answered Oct 16 '22 08:10

Patrick Hund