diff options
| author | anthony kugel <anthonykugel@gmail.com> | 2023-06-12 07:13:19 -0500 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-06-13 13:09:12 +0200 |
| commit | 68d0f95262c83adebd9ec3a416d53d8d54ada166 (patch) | |
| tree | 176b47f7d4632b25de00a356d4270fdc43fd4518 /django/test/selenium.py | |
| parent | 06881341d48dd17a4fdf25afc96991de4fb3b1ac (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.py | 9 |
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): |
