## TL;DR
Headless Firefox historically ignores `--width`/`--height` style arguments, so set the size through the driver instead: call `driver.set_window_size(w, h)` (or `manage().window().setSize` in Java bindings) right after the session starts. If that still does not stick, set the size via Firefox options preferences before launch. Verify with a screenshot and read its dimensions; do not trust layout math alone.

## The query
```text
selenium headless firefox window size ignored: how to fix
```

## Use this when
- Headless Firefox screenshots come out at the wrong resolution
- Responsive layout tests fail only in headless Firefox
- Window-size arguments seem to have no effect

## Not for
- Headless Chrome window sizing
- Headed (visible) browser sizing
- Element-not-visible errors unrelated to viewport size

## Steps
1. Launch headless Firefox via selenium and immediately call `driver.set_window_size(1920, 1080)` (adjust to your target). Expected output: no error; the command is accepted by the session.
2. Take a screenshot and check its actual pixel dimensions. Expected output: the image is 1920x1080 (or your target), confirming the size stuck.
3. If the size still does not apply, set it through Firefox options (window-size preferences) before creating the driver, then repeat step 2. Expected output: screenshot dimensions match the requested size.
4. Lock the approach into your driver factory so every headless Firefox session gets the size call. Expected output: all headless runs produce consistently sized screenshots.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_C36QgE36TiGmBF5H62hotA
