How to set window-size to fullscreen for headless-chrome using chrome options?
It worked for me and I've tested this with 6000x6000 window size. below answer helped. link
code for c#
var options = new ChromeOptions();
options.AddArgument("no-sandbox");
options.AddArgument("headless");
options.addArguments("window-size=1920,1080");
IWebDriver _driver= new ChromeDriver($@"path to chrome web driver folder", options, TimeSpan.FromSeconds(130))
;
this worked for me driver.manage().window().setSize(new Dimension(1600,700));
The problem is that headless mode is meant to be used on computers without screens, so there's no way for it to figure out what size your screen is even if you have one. The only way is for you to pass that information to the browser with --window-size.
The default window size and display size in headless mode is 800x600 on all platforms.
So the maximized window size is not applicable for chrome-headless and needs to be explicitly set by users, if required.