save file as get dimensions puppeteer js

Solutions on MaxInterview for save file as get dimensions puppeteer js by the best coders in the world

showing results for - "save file as get dimensions puppeteer js"
Theo
22 Nov 2017
1const puppeteer = require('puppeteer');
2
3(async () => {
4  const browser = await puppeteer.launch();
5  const page = await browser.newPage();
6  await page.goto('https://example.com');
7
8  // Get the "viewport" of the page, as reported by the page.
9  const dimensions = await page.evaluate(() => {
10    return {
11      width: document.documentElement.clientWidth,
12      height: document.documentElement.clientHeight,
13      deviceScaleFactor: window.devicePixelRatio,
14    };
15  });
16
17  console.log('Dimensions:', dimensions);
18
19  await browser.close();
20})();