Change desktop screen resolution for Puppeteer tests

Learn how to change the desktop screen resolution for your Puppeteer tests across browser/OS combinations on BrowserStack.

Important: Puppeteer testing on BrowserStack (beta) is not available to all users yet. If you’d like to get access, please submit a request here.

By default, all Puppeteer tests on desktop browsers run on a OS level screen resolution of 1024x768. You can use our custom resolution capability which lets you specify a different screen resolution for your tests.

Protip: Changing the screen resolution is an OS level setting for the screen. This would not change the size of viewport. You can change the viewport using the Puppeteer command page.setViewport.
Capability Description Expected values
resolution Set the resolution of your desktop OS before beginning your test A string. Default resolution is 1024x768

Supported resolutions:

Windows 10: 1024x768, 1280x800, 1280x1024, 1366x768, 1440x900, 1680x1050, 1600x1200, 1920x1200, 1920x1080 and 2048x1536

OS X: 1024x768, 1280x960, 1280x1024, 1600x1200 and 1920x1080

For example, refer to the sample of setting resolution to be 1920x1080:

const caps = {
    'resolution': '1920x1080',  // You can choose any supported resolution as per the selected OS and OS version
};
Note: You can set the screen resolution only at the start of a test. Resolution cannot be changed during test runtime.

We're sorry to hear that. Please share your feedback so we can do better







Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better







Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Talk to an Expert