summaryrefslogtreecommitdiff
path: root/django/test/selenium.py
diff options
context:
space:
mode:
authoranthony kugel <anthonykugel@gmail.com>2023-06-12 07:13:19 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-06-13 13:09:12 +0200
commit68d0f95262c83adebd9ec3a416d53d8d54ada166 (patch)
tree176b47f7d4632b25de00a356d4270fdc43fd4518 /django/test/selenium.py
parent06881341d48dd17a4fdf25afc96991de4fb3b1ac (diff)
Fixed #34649 -- Fixed headless deprecation warning on Selenium 4.8+.
Thanks David Smith for the report and initial patch.
Diffstat (limited to 'django/test/selenium.py')
-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):