I used npm i puppeteer
as stated in the Documentation
and I\'m getting the following error:
(node:2066) UnhandledPromiseRejectionWarning: Error: Chr
for linux:
1- you must have installed chromium browser using this command :
$sudo apt install -y chromium-browser
2- you have to get the excutable path of chromium using this command :
$which chromium-browser
3-put the executable path as an argument to the launch function :
const puppeteer = require('puppeteer-core');
(async () => {
const browser = await puppeteer.launch({
executablePath: '/usr/bin/chromium-browser',
headless: false
});
const page = await browser.newPage();
await page.goto('https://google.com');
await page.screenshot({path: 'example.png'});
await browser.close();
})();