How to set max viewport in Puppeteer?

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

    As explained in this issue

    page.setViewport({ width: 0, height: 0 });
    

    makes chromium set the viewport by inferring the current screen resolution. Seems to only work with headless: false

提交回复
热议问题