Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.0.4] Type defaultViewport can't be null (to take all window space) #6885

Closed
spinlud opened this issue Feb 12, 2021 · 3 comments · Fixed by #6942
Closed

[7.0.4] Type defaultViewport can't be null (to take all window space) #6885

spinlud opened this issue Feb 12, 2021 · 3 comments · Fixed by #6942

Comments

@spinlud
Copy link

spinlud commented Feb 12, 2021

  • Puppeteer version: 7.0.4
  • Node.js version: 12.x

Usually, to make viewport taking all the available space in window we need to set defaultViewport to null:

const puppeteer = require('puppeteer');

(async () => {
    const windowWidth = 1472;
    const windowHeight = 828;
    
    const browser = await puppeteer.launch({
        headless: false,
        args: [
            "--enable-automation",
            "--start-maximized",
            `--window-size=${windowWidth},${windowHeight}`,
            "--no-sandbox",
            "--disable-setuid-sandbox",
            "--disable-dev-shm-usage",
            "--proxy-server='direct://",
            "--proxy-bypass-list=*",
            "--disable-gpu",
            "--disable-accelerated-2d-canvas",
        ],
        defaultViewport: null,
        pipe: true,
    });

    const page = (await browser.pages())[0];
    const url = 'https://www.blizzard.com/en-us/';

    await page.goto(url, {
        waitUntil: 'load',
    });
})();

This doesn't seem to be allowed in typescript (defaultViewport must be of type Viewport or undefined):

image

But leaving it undefined does not give the desired result.

@Niek
Copy link

Niek commented Feb 18, 2021

Can confirm the same issue.

@jef
Copy link

jef commented Feb 18, 2021

Remove --window-size=${windowWidth},${windowHeight} and defaultViewport in favor of --start-maximized.

@christian-bromann
Copy link
Contributor

Proposed a fix for this in #6942

sadym-chromium added a commit that referenced this issue Mar 24, 2021
Fixes: #6885

Co-authored-by: Maksim Sadym <69349599+sadym-chromium@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants