Fixed #34649 -- Fixed headless deprecation warning on Selenium 4.8+.

Thanks David Smith for the report and initial patch.
This commit is contained in:
anthony kugel 2023-06-12 07:13:19 -05:00 committed by Mariusz Felisiak
parent 06881341d4
commit 68d0f95262
1 changed files with 5 additions and 4 deletions

View File

@ -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):