@cityssm/puppeteer-launch
Version:
Launch Puppeteer, falling back to system browsers when the cached ones aren't working or aren't available.
35 lines (25 loc) • 1.43 kB
Markdown
# Puppeteer Launch
[](https://www.npmjs.com/package/@cityssm/puppeteer-launch)
[](https://app.deepsource.com/gh/cityssm/puppeteer-launch/)
[](https://codecov.io/gh/cityssm/puppeteer-launch)
[](https://github.com/cityssm/puppeteer-launch/actions/workflows/coverage.yml)
A helper for `puppeteer.launch()`,
for when cached Puppeteer browsers aren't available or aren't compatible.
A drop-in replacement the falls back to system browsers automatically!
## Installation
```sh
npm install @cityssm/puppeteer-launch
```
## Usage
```javascript
import puppeteerLaunch from '@cityssm/puppeteer-launch'
// Launch the default cached browser (likely Chrome).
// Will fallback to a system browser (either Chrome, Chromium, or Firefox)
// if no cached browser is available.
const browser = await puppeteerLaunch()
// Launch a Firefox web browser.
// Will use a system Firefox if no Firefox in the Puppeteer cache.
const firefoxBrowser = await puppeteerLaunch({
browser: 'firefox'
})
```