I am running this code with python, selenium, and firefox but still get 'head' version of firefox:
binary = FirefoxBinary('C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe', log_file=sys.stdout)
binary.add_command_line_options('-headless')
self.driver = webdriver.Firefox(firefox_binary=binary)
I also tried some variations of binary:
binary = FirefoxBinary('C:\\Program Files\\Nightly\\firefox.exe', log_file=sys.stdout)
binary.add_command_line_options("--headless")
To invoke Firefox Browser headlessly, you can set the
headless
property throughOptions()
class as follows:There's another way to accomplish headless mode. If you need to disable or enable the headless mode in Firefox, without changing the code, you can set the environment variable
MOZ_HEADLESS
to whatever if you want Firefox to run headless, or don't set it at all.This is very useful when you are using for example continuous integration and you want to run the functional tests in the server but still be able to run the tests in normal mode in your PC.
or
My answer:
https://seleniumhq.github.io/selenium/docs/api/py/webdriver_firefox/selenium.webdriver.firefox.options.html
works for me