puppeteer – screenshot.js


const browser = await puppeteer.launch();

const page = await browser.newPage();

await page.setViewport({
    width: 1920,
    height: 1080,
    deviceScaleFactor: 1,

await page.emulateMedia('screen');
await page.goto('https://csrone.com/');
await page.evaluate(function() {

// force lazy loading
await page.evaluate(() => window.scrollTo(0, Number.MAX_SAFE_INTEGER));

// Here I'd love to use page.waitForNetworkIdle() instead of something similar
await page.waitFor(500);

await page.screenshot({
    path: 'screenshot.png',
    fullPage: true

await browser.close();

Leave a Reply

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>