Skip to content

Instantly share code, notes, and snippets.

@leohmoraes
Created August 18, 2019 19:55
Show Gist options
  • Save leohmoraes/72f755fe09b97c4bb7369a601bc1a835 to your computer and use it in GitHub Desktop.
Save leohmoraes/72f755fe09b97c4bb7369a601bc1a835 to your computer and use it in GitHub Desktop.
robot puppeteer node print de uma parte da tela
const puppeteer = require('puppeteer');
const options = {
path: 'amazon-header.png',
fullPage: false,
clip: {
x: 0,
y: 0,
width: 1280,
height: 150
}
}
puppeteer.launch().then(async browser => {
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800 })
await page.goto('https://www.amazon.com');
await page.screenshot(options);
await browser.close();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment