I am running headless Selenium tests on Azure DevOps (formerly VSTS) with ChromeDriver—see the article here https://learn.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-selenium?view=azure-devops on how to set this up.
I have an issue where tests fail due to an element not being visible and I suspect it's because of the media queries in CSS which force a different layout than expected. (I am expecting to test the desktop rendering of the site.)
What is the default window size for Selenium when running on a VSTS build?
As discussed in a previous comment, you can set window-size and start chrome maximized using ChromeOptions, such as (in C#):
// use headless chrome
var options = new ChromeOptions();
options.AddArguments(new List<string>()
{
"--headless",
"--disable-gpu",
"--no-first-run",
"--no-default-browser-check",
"--ignore-certificate-errors",
"--no-sandbox",
"--window-size=1280,1920",
"--start-maximized",
"--disable-dev-shm-usage",
});
WebDriver = new ChromeDriver(".", options);
Note: I am use Selenium.WebDriver.ChromeDriver v75.0.3770.140, and running on an Azure DevOps Services Windows 2019 with VS2019 agent, which is currently configured with Chrome v75.0.3770.100
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With