How to set max viewport in Puppeteer?

前端 未结 8 1067
一整个雨季
一整个雨季 2021-02-01 02:04

When I run a new page, I must specify size of the viewport using the setViewport function:

await page.setViewport({
    width: 1920,
    height: 108         


        
8条回答
  •  情深已故
    2021-02-01 02:16

    I may be very late on this. Nevertheless for others, try:

    const browser = await puppeteer.launch({defaultViewport: null});
    

    Set the defaultViewport option to null as above to disable the 800x600 resolution. It takes the max resolution then.

提交回复
热议问题