The page at https://developer.mozilla.org/en-US/Firefox/Headless_modeThis page lists the --window-size=x,y
which you can add with opts.add_argument("--window-size=1900,1080")
.
Complete example which works with latest firefox v57b8 (assumes you have geckodriver
somewhere in your $PATH
):
caps = webdriver.DesiredCapabilities().FIREFOX
opts = FirefoxOptions()
opts.add_argument("-headless")
opts.add_argument("--window-size=1900,1080")
caps["marionette"] = True
driver = webdriver.Firefox(capabilities=caps, firefox_options=opts)