﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34649	Modernise selenium --headless support	David Smith	Anthony Kugel	"Django's own test suite supports `--headless mode` for Selenium tests. 

This is currently achieved by setting `option.headless=True`, [https://github.com/django/django/blob/221c27bd6a10155f65c9f93ecc67a61c76befbb7/django/test/selenium.py#L83 source]. 

However, this approach is ""going away"", see [https://www.selenium.dev/blog/2023/headless-is-going-away/ blog post] and [https://www.selenium.dev/blog/2023/selenium-4-8-0-released/ release notes]. This warning can be seen in recent runs on djangoci, see [https://djangoci.com/job/django-selenium/1502/database=sqlite3,label=focal,python=python3.11/console logs].

Instead we should add an argument to the options.

For Chrome: `options.add_argument(""--headless=new"")`, see [https://www.selenium.dev/blog/2023/headless-is-going-away/#after docs]
For Firefox: `options.add_argument(""-headless"")`, see [https://www.selenium.dev/documentation/webdriver/browsers/firefox/#arguments docs]

There's more more background [https://developer.chrome.com/articles/new-headless/ here] on the Chrome change. Eventually the `new` version will become the default with the current headless mode being removed. 

Maybe something like this could work:

{{{
    def create_options(self):
        options = self.import_options(self.browser)()
        if self.headless:
            match self.browser:
                case ""chrome"":
                    options.add_argument(""--headless=new"")
                case ""firefox"":
                    options.add_argument(""-headless"")
        return options

}}}"	Cleanup/optimization	closed	Testing framework	4.2	Normal	fixed		Sarah Boyce	Ready for checkin	1	0	0	0	1	0
