Firefox headless mode windowSize() option doesn't work
Meta -
OS: Mac OS
Selenium Version: 4.0.0-alpha.1
Browser: Firefox (using GeckoDriver)
Browser Version: 61.0
Expected Behavior -
Setting the window size when running Firefox in headless mode should set it to the given height and width. This is necessary because the web app I'm working with has buttons that are out of view if opened at a certain resolution. This is how I'm instantiating the WebDriver:
const {Builder, By, Key, until} = require('selenium-webdriver');
const firefox = require('selenium-webdriver/firefox');
const url = process.env.PIXEL_URL;
var browser = null;
beforeAll(async () => {
let options = new firefox.Options()
.headless()
.addArguments('--window-size=1920,1200');
// .windowSize({width: 1920, height: 1200}); // this didn't work either
browser = await new Builder()
.forBrowser('firefox')
.setFirefoxOptions(options)
.build();
await browser.get(url);
}
I'm using this as a guide for which methods I can use.
Actual Behavior -
The window is opened at 1024x617 resolution, which causes some of my buttons to be out of view resulting in my test failing due to the following error:
MoveTargetOutOfBoundsError: (196.01667022705078, 787.1000061035156) is out of bounds of viewport width (1024) and height (617)
Steps to reproduce -
Create a new Builder() with setFirefoxOptions() options including headless() and windowSize({width: 1920, height: 1200}).
The headless browser should now be at a 1920x1200 resolution, but is instead at a fixed resolution.
https://github.com/SeleniumHQ/selenium/pull/6075