Another follow-up to my own post. I'm seeing an issue where the --headless=new argument does not use the --window-size argument if the what Chrome sees as the screen resolution is smaller. We are seeing this when running some cucumber tests through our Jenkins pipelines. I'm also seeing this when manually running these cucumber features from a command line when remote desktopped into our test running system. If I set my RD session to use a screen size smaller (800x600 for an extreme example) than the window-size argument, the Chrome sets itself up to use a work area the same size as my screen resolution.
From the Defaults: file in the working directory
"browser":{"check_default_browser":false,"window_placement":{"bottom":0,"left":0,"maximized":false,"right":0,"top":0,"work_area_bottom":560,"work_area_left":0,"work_area_right":800,"work_area_top":0}}
In my Selenium configuration options:
if TestBrowser == 'chrome'
options = Selenium::WebDriver::Chrome::Options.new
#Using Headless New Mode as the old headless mode is having problems.
if UseHeadlessMode == 'true'
options.add_argument('--headless=new')
end
options.add_argument('--start-maximized')
options.add_argument('--disable-popup-blocking')
options.add_argument('--disable-extensions')
options.add_argument('--window-size=1960,1080')
options.add_argument('--disable-features=VizDisplayCompositor')
#options.add_argument('--enable-logging')
#options.add_argument('--v=1')
options.add_argument('--user-data-dir=C:\FourthTest')
I've been messing around with different options, like not using the --start-maximized, but nothing is really working the way the old headless mode used to work in regards to using the window-size parameters.