Change Screen Resolution

Learn how to change the screen resolution for your desktop Selenium tests.

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

Note: Browser window is not maximized upon launch in any Selenium test. Changing the resolution will not maximize browser. See how to maximize and resize the browser window here.
Capability Description Expected values
resolution Set the resolution of your VM before beginning your test A string. Default resolution is 1024x768

Supported resolutions:
Windows (XP, 7): 800x600, 1024x768, 1280x800, 1280x1024, 1366x768, 1440x900, 1680x1050, 1600x1200, 1920x1200, 1920x1080 and 2048x1536

Windows (8, 8.1, 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:

// Change resolution to 1920x1080

DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("resolution", "1920x1080");
// Change resolution to 1920x1080

var capabilities = {
 "resolution" : "1920x1080"
}
// Change resolution to 1920x1080

DesiredCapabilities caps = new DesiredCapabilities();
caps.SetCapability("resolution", "1920x1080");
# Change resolution to 1920x1080

$caps = array(
 "resolution" => "1920x1080"
);
# Change resolution to 1920x1080

capabilities = {
 "resolution": "1920x1080"
}
# Change resolution to 1920x1080

caps = Selenium::WebDriver::Remote::Capabilities.new
caps["resolution"] = "1920x1080"
# Allowing all cookies in Safari

my $capabilities = {
  "resolution" => "1920x1080"
}

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