Open Bug 1387585 Opened 7 years ago Updated 11 months ago

Add ability to set initial size on Windowless Browser

Categories

(Firefox :: Headless, enhancement, P3)

enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: ronoueb, Unassigned)

Details

Should be able to specify initial dimensions when creating a windowless browser so we can avoiding resizing after creation.
Priority: -- → P3
not sure what a "windowless" browser is, but i need to set the initial firefox window size too.

my experiments indicate that resizing windows bigger in xvfb wont render the new size, we simply get black beyound the initial window size. so i assume - for xvfb - we have to start applications with the correct window size.

FWIW, chromium has such option, and thus works properly in xvfb:
(this code is from python3 selenium bindings)

```
options = ChromeOptions()
options.add_argument("--kiosk") # to get fullscreen.
options.add_argument("--disable-infobars") # thanks for the useless ui spam...
chromeOptions.add_argument("--window-position=0,0") # fix kiosk mode in xvfb?
chromeOptions.add_argument("--window-size="+screenSize[0]+","+screenSize[1]) # xvfb needs correct window size on app start?
self.browser = Webdriver.Chrome(chrome_options=options)
```
Isn’t this the --window-size flag, or am I misunderstanding?

>   --window-size width[,height] Width and optionally height of screenshot.

There is also MOZ_HEADLESS_WIDTH and MOZ_HEADLESS_HEIGHT environment
variables.
it sais "Width and optionally height of screenshot." so its only for the screenshot size?

i dont see any change in default firefox window size with this:
```
options = FirefoxOptions()
options.add_argument("--window-size "+screenSize[0]+","+screenSize[1])
self.browser = Webdriver.Firefox(options=options)
```

and environment variables MOZ_HEADLESS_WIDTH and MOZ_HEADLESS_HEIGHT doesnt seem to change normal firefox windows size.

i need to write a test with vanilla xvfb and firefox...

btw. this ticket is about "headless" firefox component, should i open a new ticket for "normal" firefox?
I don’t know if --window-size is meant to work in non-headless mode,
but the environmental variables I cited certainly only work in
headless mode, which is not Xvfb.

This bug is specifically about setting the window size in headless
mode.

I have mentioned this bug fix on my blog https://titrazh.net/

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.