Opened 17 months ago
Closed 17 months ago
#34649 closed Cleanup/optimization (fixed)
Modernise selenium --headless support
Reported by: | David Smith | Owned by: | Anthony Kugel |
---|---|---|---|
Component: | Testing framework | Version: | 4.2 |
Severity: | Normal | Keywords: | |
Cc: | Sarah Boyce | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Django's own test suite supports --headless mode
for Selenium tests.
This is currently achieved by setting option.headless=True
, source.
However, this approach is "going away", see blog post and release notes. This warning can be seen in recent runs on djangoci, see logs.
Instead we should add an argument to the options.
For Chrome: options.add_argument("--headless=new")
, see docs
For Firefox: options.add_argument("-headless")
, see docs
There's more more background 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
Change History (6)
comment:1 by , 17 months ago
Cc: | added |
---|---|
Component: | Uncategorized → Testing framework |
Easy pickings: | set |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 17 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 17 months ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:4 by , 17 months ago
Owner: | set to |
---|---|
Status: | new → assigned |
Thank you for the report!