Puppeteer on FreeBSD 12.1

1. Install Chromium

# pkg install chromium

2. Install puppeteer alone

# PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install puppeteer@1.0.0

3. Launch puppeteer with executablePath

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({
    executablePath: '/usr/local/bin/chrome',
  })

  const page = await browser.newPage()
  await page.goto('https://github.com/GoogleChrome/puppeteer')
  await page.screenshot({path: 'example.png'})
  await page.pdf({
    path: 'example.pdf',
    format: 'A4',
    printBackground: true,
  })

  await browser.close()
})()

Ref:

https://github.com/puppeteer/puppeteer/issues/1049#issuecomment-381846813

Ext:

puppeteer-extra
puppeteer-extra-plugin-stealth
https://github.com/puppeteer/puppeteer/issues/4871#issuecomment-549771954

Leave a Reply

Your email address will not be published. Required fields are marked *