How to set max viewport in Puppeteer?

前端 未结 8 1066
一整个雨季
一整个雨季 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:34

    I had the same problem and what worked for me is this.

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

提交回复
热议问题