Puppeteer Chromium Resolver
Tool to resolve puppeteer and chromium faster, detect local installed chromium, download chromium with custom mirror host, cache chromium revision out of node_modules, test chromium headless being launchable.
- Tool to customize puppeteer
- Detect local chromium automatically
- Download chromium from custom mirror host
- Cache chromium to local folder
- Try launching chromium and resolve launchable and version
- Resolve chromium executablePath and puppeteer
Install
npm install puppeteer-chromium-resolver --save
Usage
const PCR = require("puppeteer-chromium-resolver");
const pcr = await PCR();
const browser = await pcr.puppeteer.launch({
headless: true,
args: ['--no-sandbox'],
executablePath: pcr.executablePath
}).catch(function (error) {
console.log(error);
});
const page = await browser.newPage();
await page.goto('https://www.google.com');
await browser.close();
Option
const pcr = await PCR({
revision: "",
detectionPath: "",
folderName: '.chromium-browser-snapshots',
hosts: ["https://storage.googleapis.com", "https://npm.taobao.org/mirrors"],
retry: 3,
silent: false
});
Properties
Property | Type | |
---|
revision | String | current chromium revision |
executablePath | String | chromium executable path |
folderPath | String | chromium folder path |
local | Boolean | exists local chromium |
url | String | chromium download url |
launchable | Boolean | chromium launchable |
chromiumVersion | String | chromium version |
puppeteer | Object | puppeteer module |
puppeteerVersion | String | puppeteer version |
CHANGELOG
-
v2.0.1
- updated puppeteer-core version to v1.19.0
- refactoring with async/await
- fixed requesting timeout
-
v1.0.12
- updated puppeteer-core version to v1.18.1
- fixed a gauge log issue