Change desktop screen resolution
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" |
|
Copy
caps = Selenium::WebDriver::Remote::Capabilities.new
caps["screen-resolution"] = "1280x1024"
Copy
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("screen-resolution", "1280x1024");
Copy
$caps = array(
"screen-resolution" => "1280x1024"
);
Copy
capabilities = {
"screen-resolution" : "1280x1024"
}
Copy
const capabilities = {
"screen-resolution" : "1280x1024"
}
Copy
// For Chrome browser
OpenQA.Selenium.Chrome.ChromeOptions chromeCapability = new OpenQA.Selenium.Chrome.ChromeOptions();
capability.AddAdditionalCapability("resolution", "1280x1024", true);
// For Edge browser
OpenQA.Selenium.Edge.EdgeOptions edgecapability = new OpenQA.Selenium.Edge.EdgeOptions();
capability.AddAdditionalCapability("resolution", "1280x1024");
// For IE browser
OpenQA.Selenium.IE.InternetExplorerOptions ieCapability = new OpenQA.Selenium.IE.InternetExplorerOptions();
capability.AddAdditionalCapability("resolution", "1280x1024", true);
// For Firefox browser
OpenQA.Selenium.Firefox.FirefoxOptions firefoxCapability = new OpenQA.Selenium.Firefox.FirefoxOptions();
capability.AddAdditionalCapability("resolution", "1280x1024", true);
// For Safari browser
OpenQA.Selenium.Safari.SafariOptions safariCapability = new OpenQA.Selenium.Safari.SafariOptions();
safariCapability.AddAdditionalCapability("resolution", "1280x1024");
// For Opera browser
OpenQA.Selenium.Opera.OperaOptions operaCapability = new OpenQA.Selenium.Opera.OperaOptions();
operaCapability.AddAdditionalCapability("resolution", "1280x1024");
The browser window is not maximized when starting a Selenium test. Changing the screen resolution does not maximize browser.
See how to maximize and resize the browser window.