summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/test/selenium.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/django/test/selenium.py b/django/test/selenium.py
index aa714ad365..86ff9e2f4f 100644
--- a/django/test/selenium.py
+++ b/django/test/selenium.py
@@ -79,10 +79,11 @@ class SeleniumTestCaseBase(type(LiveServerTestCase)):
def create_options(self):
options = self.import_options(self.browser)()
if self.headless:
- try:
- options.headless = True
- except AttributeError:
- pass # Only Chrome and Firefox support the headless mode.
+ match self.browser:
+ case "chrome":
+ options.add_argument("--headless=new")
+ case "firefox":
+ options.add_argument("-headless")
return options
def create_webdriver(self):