Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Chrome Headless using NPM

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!!!

like image 333
Abhi Avatar asked Jun 13 '17 08:06

Abhi


People also ask

Which Chrome version is headless?

Note: Headless mode has been available on Mac and Linux since Chrome 59. Windows support came in Chrome 60.

Is Chrome 60 is a headless web browser?

Starting with version 60, the Chrome browser introduced the ability to run in headless mode. We now have the ability to launch the browser without creating a visual browser window.

What is Chromedriver headless?

Headless mode is a functionality that allows the execution of a full version of the latest Chrome browser while controlling it programmatically. It can be used on servers without dedicated graphics or display, meaning that it runs without its “head”, the Graphical User Interface (GUI).


2 Answers

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

like image 150
Rooster Avatar answered Oct 01 '22 16:10

Rooster


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

npm install chromium

For windows:

\node_modules\chromium\lib\chromium\chrome-win\chrome.exe 
like image 41
alansiqueira27 Avatar answered Oct 01 '22 16:10

alansiqueira27