Created
January 24, 2020 14:04
-
-
Save bdelacretaz/64ae25126932702c9d78e93871d6c86a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Example capturing a 1200 x 6000 pixels screenshot | |
// from a website using https://github.com/microsoft/playwright | |
const pw = require('playwright'); | |
(async () => { | |
const browser = await pw.firefox.launch(); // or 'chromium', 'firefox' | |
const context = await browser.newContext(); | |
const page = await context.newPage(); | |
await page.goto('https://lecourrier.ch/'); | |
const watchDog = page.mainFrame().waitForFunction('window.innerWidth > 1000'); | |
page.setViewport({width: 1200, height: 6000}); | |
await watchDog; | |
await page.screenshot({ path: 'lecourrier.png' }); | |
await browser.close(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment