#browser-automation ## Chrome > [!info] > The things I collected here may become obsolete with [Chrome's new headless mode](https://developer.chrome.com/articles/new-headless/) ### Viewport height is greater in headless mode When running Chrome in headless mode, it provides a greater viewport height than when in headful mode. It seems that the browser chrome (i.e. the UI elements, such as address bar and buttons) is missing in headless mode. This may lead to confusing results when an automated test is making assumptions about the viewport height, especially when a test is authored in a head**ful** instance of Chrome and then run in a head**less** instance. Interestingly, Firefox behavior is different: The viewport height is always the same, both in headless mode and headful mode. ### `Accept-Language` header not set as expected When running Chrome in headless mode, it does not send the same `Accept-Language` header as when in headful mode. It seems to use the browser's default setting, which is `en-US`, because [preference handling is not included in headless Chromium](https://bugs.chromium.org/p/chromedriver/issues/detail?id=1925). With WebDriver, this can be solved by passing Chrome a locale when starting it: ```js // Works with https://www.npmjs.com/package/selenium-webdriver let chromeOptions = new chrome.Options(capabilities); chromeOptions.addArguments('--lang=de-DE'); ``` ### Incognito mode not working in headless Chrome When starting Chrome in headless mode **via the headless flag of Chromedriver**, there is no incognito functionality available. To avoid this, one has to run Chrome in „native headless“ mode by starting Chrome with these CLI flags: ``` --headless=chrome ``` In WebDriver, you can do it like so: ```js // Works with https://www.npmjs.com/package/selenium-webdriver let chromeOptions = new chrome.Options(capabilities); chromeOptions.addArguments('headless=chrome'); ``` See also: - [addArguments in the docs](https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/chrome_exports_Options.html#addArguments) - [Thread in the Chromedriver Google Group](https://groups.google.com/g/chromedriver-users/c/XclDou5fS6s/m/WMRM2S7WBAAJ)