[Django] #34649: Modernise selenium --headless support

0 views
Skip to first unread message

Django

unread,
Jun 11, 2023, 5:12:16 AM6/11/23
to django-...@googlegroups.com
#34649: Modernise selenium --headless support
-----------------------------------------+------------------------
Reporter: David Smith | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
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

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34649>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 12, 2023, 2:35:42 AM6/12/23
to django-...@googlegroups.com
#34649: Modernise selenium --headless support
--------------------------------------+------------------------------------

Reporter: David Smith | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Sarah Boyce):

* cc: Sarah Boyce (added)
* type: Uncategorized => Cleanup/optimization
* component: Uncategorized => Testing framework
* easy: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Thank you for the report!

--
Ticket URL: <https://code.djangoproject.com/ticket/34649#comment:1>

Django

unread,
Jun 12, 2023, 7:50:02 AM6/12/23
to django-...@googlegroups.com
#34649: Modernise selenium --headless support
--------------------------------------+------------------------------------
Reporter: David Smith | Owner: Bhuvnesh
Type: Cleanup/optimization | Status: assigned

Component: Testing framework | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Bhuvnesh):

* owner: nobody => Bhuvnesh
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/34649#comment:2>

Django

unread,
Jun 12, 2023, 7:56:28 AM6/12/23
to django-...@googlegroups.com
#34649: Modernise selenium --headless support
--------------------------------------+------------------------------------
Reporter: David Smith | Owner: (none)
Type: Cleanup/optimization | Status: new

Component: Testing framework | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Bhuvnesh):

* owner: Bhuvnesh => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/34649#comment:3>

Django

unread,
Jun 12, 2023, 8:34:56 AM6/12/23
to django-...@googlegroups.com
#34649: Modernise selenium --headless support
--------------------------------------+------------------------------------
Reporter: David Smith | Owner: aokugel
Type: Cleanup/optimization | Status: assigned

Component: Testing framework | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aokugel):

* owner: (none) => aokugel


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/34649#comment:4>

Django

unread,
Jun 13, 2023, 3:54:06 AM6/13/23
to django-...@googlegroups.com
#34649: Modernise selenium --headless support
-------------------------------------+-------------------------------------
Reporter: David Smith | Owner: Anthony
Type: | Kugel

Cleanup/optimization | Status: assigned
Component: Testing framework | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* has_patch: 0 => 1
* stage: Accepted => Ready for checkin


Comment:

[https://github.com/django/django/pull/16965 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/34649#comment:5>

Django

unread,
Jun 13, 2023, 7:10:26 AM6/13/23
to django-...@googlegroups.com
#34649: Modernise selenium --headless support
-------------------------------------+-------------------------------------
Reporter: David Smith | Owner: Anthony
Type: | Kugel
Cleanup/optimization | Status: closed

Component: Testing framework | Version: 4.2
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"68d0f95262c83adebd9ec3a416d53d8d54ada166" 68d0f95]:
{{{
#!CommitTicketReference repository=""
revision="68d0f95262c83adebd9ec3a416d53d8d54ada166"
Fixed #34649 -- Fixed headless deprecation warning on Selenium 4.8+.

Thanks David Smith for the report and initial patch.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34649#comment:6>

Reply all
Reply to author
Forward
0 new messages