Sometimes, we want to set max viewport in Puppeteer.
In this article, we’ll look at how to set max viewport in Puppeteer.
How to set max viewport in Puppeteer?
To set max viewport in Puppeteer, we set the defaultViewport
option to null
.
For instance, we write
const browser = await puppeteer.launch({ defaultViewport: null });
to call puppeteer.luanch
with an object that has defaultViewport
set to null
.
This will make Puppeteer launch with the max viewport resolution instead of 800×600.
Conclusion
To set max viewport in Puppeteer, we set the defaultViewport
option to null
.