Skip to main content

Change desktop screen resolution for Playwright tests

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

By default, all Playwright tests on desktop browsers run on a OS level screen resolution of 1920x1080. 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 set viewport as null while creating newContext so that the viewport takes the entire screen space. Read more about setting viewport.
Capability Description Expected values
resolution Set the resolution of your desktop OS before beginning your test A string. Default resolution is 1920x1080

Supported resolutions:

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

OS X: 1024x768, 1280x960, 1280x1024, 1600x1200, 1920x1080, 2560x1440, 2560x1600 and 3840x2160

For example, refer to the sample of setting resolution to be 1024x768:

const caps = {
    'resolution': '1024x768',  // 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