Run Puppeteer Scripts with Deno
First you'll want to run the install script.
deno eval "import 'npm:puppeteer/install.mjs'"
Puppeteer's now globally ready. You can run the following script to use it as you'd expect.
import puppeteer from 'npm:puppeteer'
const browser = await puppeteer.launch({ headless: true })
const page = await browser.newPage()
await page.goto('https://hivoltage.xyz')
await page.screenshot({ path: 'hivoltage.xyz.png' })
// This line takes a while to finish, not sure why
await browser.close()
For production level projects or other projects where determinism is important, consider pinning a version, like npm:[email protected]
.