The right way to run Firefox in headless mode (Selenium, Python) The right way to run Firefox in headless mode (Selenium, Python) selenium selenium

The right way to run Firefox in headless mode (Selenium, Python)


The first solutions sets an environment variable on your computer, i.e. changing your platform. According to the docs

If the platform supports the putenv() function, this mapping may be used to modify the environment

It will work only if your platform supports putenv()

Availability: most flavors of Unix, Windows.

The second solution sets the webdriver instance with some options, without changing your platform.