Install Chrome Headless using NPM

Abhi picture Abhi · Jun 13, 2017 · Viewed 19k times · Source

Chrome Headless is fantastic!!!

But is there a way I can install Chrome Headless using NPM so that can I use it for my unit tests in automated test environments?

Is there an alternative way of doing this?

Many thanks in advance!!!

Answer

Rooster picture Rooster · Nov 1, 2017

chrome is bundled with the puppeteer package on npm by default. Puppeteer provides a nice API for using chrome headless for automated tests or even regular chrome (headless turned off).

https://www.npmjs.com/package/puppeteer

https://github.com/GoogleChrome/puppeteer

npm install puppeteer