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

[BUG] Cannot read property 'width' of null for Webkit screenshot #887

Closed
mmarkelov opened this issue Feb 7, 2020 · 1 comment · Fixed by #913
Closed

[BUG] Cannot read property 'width' of null for Webkit screenshot #887

mmarkelov opened this issue Feb 7, 2020 · 1 comment · Fixed by #913

Comments

@mmarkelov
Copy link

Context:

  • Playwright Version: [0.10.0]
  • Operating System: [Mac]

Code Snippet

const playwright = require('playwright');

(async () => {
    for (const browserType of ['chromium', 'firefox', 'webkit']) {
        const browser = await playwright[browserType].launch();
        const context = await browser.newContext({viewport: null});
        const page = await context.newPage('https://whatismybrowser.com/');

        await page.screenshot({ path: `example-${browserType}.png` });
        await browser.close();
    }
})();

Describe the bug

According to documentation viewport option can be null. And in this case I got error with Webkit: UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'width' of null from here:

const rect = options.clip || { x: 0, y: 0, width: viewportSize.width, height: viewportSize.height };

So I suppose it should have some checks for viewport.

I can make PR to fix this.
Thanks!

@pavelfeldman
Copy link
Member

Thanks for the report! I'll use this opportunity to rearrange some of the logic and add a test for this one, hesitant asking for a PR here due to all this extra work.

sand4rt pushed a commit to sand4rt/playwright that referenced this issue Dec 21, 2022
Co-authored-by: github-actions <41898282+github-actions[bot]@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.

2 participants