Categories
JavaScript Answers

How to set max viewport in Node Puppeteer?

Spread the love

To set max viewport in Node Puppeteer, we set the --window-size option.

For instance, we write

const browser = await puppeteer.launch({
  headless: false,
  args: ["--window-size=1920,1080"],
  defaultViewport: null,
});

to call launch to launch the browser.

We set args to ["--window-size=1920,1080"] to make the window size 1920×1080.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *