Newer
Older
sample-puppeteer / index.js
yhornisse on 18 May 2020 530 bytes Add sample code
#!/usr/bin/node

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'] });
  const page = await browser.newPage();
  // sample1
  await page.goto('https://pied-piper.net/gitbucket/');
  await page.screenshot({path: './sample1.png', fullPage:true});

  // sample1
  await page.goto('https://pied-piper.net/note/');
  let item = await page.$('#profile')
  await item.screenshot({path: './sample2.png'});

  await browser.close();
})();