question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can I change the viewport size same to window inner size with Puppeteer helper?

See original GitHub issue

Details

  • CodeceptJS version:1.3.3
  • NodeJS Version:10.8.0
  • Operating System: Macos
  • Protractor || WebDriverIO || Nightmare version (if related): Puppeteer 1.8.0
  • Configuration file:
  helpers: {
    Puppeteer: {
      url: cf.testDomain,
      show: true,
      restart: false,
      keepCookies: true,
      windowSize: '1920x1080',
      chrome: {
        defaultViewport: {
          width: 1920,
          height: 1080
        },
        handleSIGINT: false,
      },
    },
  }

In the codecept.conf.js file, I set windowSize and defaultViewport with the same value, but when I run test test suite:

  • The viewport size of chrome is still 800x600.
  • The window inner size of the webpage is 1920x1080. This is not convenient to debug by viewport. jietu20180917-175801-hd

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

6reactions
PeterNgTrcommented, Dec 17, 2018
   Puppeteer: {
      url: 'https://google.com',
      restart: false,
      keepBrowserState: true,
      keepCookies: true,
      fullPageScreenshots: true,
      show: true,
      windowSize: '1440x700',
      waitForNavigation: ['networkidle2', 'domcontentloaded'],
      waitForAction: 1000,
      chrome: {
        args: ['--no-sandbox', '--window-size=1440,700'],
      },
    },

This works fine for me.

0reactions
mystic-poetcommented, Jan 8, 2022

Any solution to this? I tried updating the codecept.conf.js file, but it did not help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can I change the viewport size same to window inner ... - GitHub
In the codecept.conf.js file, I set windowSize and defaultViewport with the same value, but when I run test test suite: ... The window...
Read more >
How to set max viewport in Puppeteer? - Stack Overflow
launch() to change the window size to your desired width and height . Then you can call the Chrome Devtools Protocol method Emulation....
Read more >
Page.setViewport() method - Puppeteer
page.setViewport will resize the page. A lot of websites don't expect phones to change size, so you should set the viewport before navigating...
Read more >
Change desktop screen resolution for Puppeteer tests
Learn how to change the desktop screen resolution for your Puppeteer tests across browser/OS combinations on ... This would not change the size...
Read more >
Puppeteer documentation - DevDocs
Puppeteer 7.1.0 API documentation with instant search, offline support, keyboard shortcuts, mobile version, and more.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found