Created
August 18, 2019 19:55
-
-
Save leohmoraes/72f755fe09b97c4bb7369a601bc1a835 to your computer and use it in GitHub Desktop.
robot puppeteer node print de uma parte da tela
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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