Skip to main content

Change desktop screen resolution with Selenium

The TestingBot Desktop VMs (Windows, macOS and Linux) all support changing the screen resolution before a test starts.

We currently support the following screen resolutions:

Value Type Default Value
string "1280x1024"
Platform Resolutions
Windows/Linux
  • 800x600
  • 1024x768
  • 1152x864
  • 1280x768
  • 1280x800
  • 1280x960
  • 1280x1024
  • 1400x1050
  • 1600x1200
  • 1680x1050
  • 1920x1080
  • 1920x1200
  • 2560x1440
macOS
  • 800x600
  • 1024x768
  • 1280x768
  • 1280x800
  • 1280x960
  • 1280x1024
  • 1366x768
  • 1440x900
  • 1600x900
  • 1600x1200
  • 1680x1050
  • 1920x1080
  • 1920x1200
  • 2048x1536
ChromeOptions options = new ChromeOptions();
options.setCapability("platformName", "WIN11");
options.setCapability("browserVersion", "latest");
options.setCapability("screen-resolution", "1920x1080");

HashMap<String, Object> tbOptions = new HashMap<>();
tbOptions.put("key", "API_KEY");
tbOptions.put("secret", "API_SECRET");
options.setCapability("tb:options", tbOptions);
from selenium.webdriver.chrome.options import Options as ChromeOptions

options = ChromeOptions()
options.set_capability('platformName', 'WIN11')
options.set_capability('browserVersion', 'latest')
options.set_capability('screen-resolution', '1920x1080')
options.set_capability('tb:options', {
    'key': 'API_KEY',
    'secret': 'API_SECRET'
})
const capabilities = {
  platformName: 'WIN11',
  browserName: 'chrome',
  browserVersion: 'latest',
  'screen-resolution': '1920x1080',
  'tb:options': {
    key: 'API_KEY',
    secret: 'API_SECRET'
  }
};
options = Selenium::WebDriver::Chrome::Options.new
options.add_option('platformName', 'WIN11')
options.add_option('browserVersion', 'latest')
options.add_option('screen-resolution', '1920x1080')
options.add_option('tb:options', {
  'key' => 'API_KEY',
  'secret' => 'API_SECRET'
})
$capabilities = [
    'platformName' => 'WIN11',
    'browserName' => 'chrome',
    'browserVersion' => 'latest',
    'screen-resolution' => '1920x1080',
    'tb:options' => [
        'key' => 'API_KEY',
        'secret' => 'API_SECRET'
    ]
];
ChromeOptions options = new ChromeOptions();
options.PlatformName = "WIN11";
options.BrowserVersion = "latest";
options.AddAdditionalOption("screen-resolution", "1920x1080");

var tbOptions = new Dictionary<string, object>
{
    ["key"] = "API_KEY",
    ["secret"] = "API_SECRET"
};
options.AddAdditionalOption("tb:options", tbOptions);

The browser window is not maximized when starting a Selenium test. Changing the screen resolution does not maximize the browser.
See how to maximize and resize the browser window.

Was this page helpful?

Looking for More Help?

Have questions or need more information?
You can reach us via the following channels: