Change desktop screen resolution for Automation tests
Learn how to change the desktop screen resolution for your Automation tests across browser combinations on BrowserStack.
The resolution
capability is not available in headless mode. To set a resolution, disable headless mode by setting the capability headless
: false
.
You can use our custom resolution
capability which lets you specify a different screen resolution for your tests.
Capability | Description | Expected values |
---|---|---|
resolution |
Set the resolution of your VM before beginning your test | A string. Default resolution is 1920x1080 |
For example, refer to the sample of setting resolution to be 1024x768:
const caps = {
'resolution': '1024x768'
};
- You can set the screen resolution only at the start of a test.
- Resolution cannot be changed during test runtime.
- If you want to change browser window size during test runtime, then ensure that you have chosen a sufficiently large screen resolution such that page elements do not appear off-screen.
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
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!