f9mac / puppeteer-extra-plugin-aws

A plugin for puppeteer-extra to run puppeteer on AWS infrastructure like ECS or EC2
MIT License
4 stars 0 forks source link
aws puppeteer puppeteer-aws puppeteer-extra puppeteer-plugins

puppeteer-extra-plugin-aws

A plugin for puppeteer-extra to run puppeteer on AWS infrastructure like ECS or EC2. (Might also work on Lambda)

Install

yarn add puppeteer-extra-plugin-aws
# - or -
npm install puppeteer-extra-plugin-aws

If this is your first puppeteer-extra plugin here's everything you need:

yarn add puppeteer puppeteer-extra puppeteer-extra-plugin-aws
# - or -
npm install puppeteer puppeteer-extra puppeteer-extra-plugin-aws

Usage

// puppeteer-extra is a drop-in replacement for puppeteer,
// it augments the installed puppeteer with plugin functionality
const puppeteer = require('puppeteer-extra');
// require AWS plugin
const awsPlugin = require('puppeteer-extra-plugin-aws');
// add AWS plugin
puppeteer.use(awsPlugin());

// puppeteer usage as normal
puppeteer.launch({ headless: true }).then(async browser => {
  const page = await browser.newPage()
  await page.setViewport({ width: 800, height: 600 })
  // will work on AWS
  await page.goto("https://example.com")
  await page.waitFor(5000)
  await browser.close()
})

For more info see the tests.