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): def create_options(self):
options = self.import_options(self.browser)() options = self.import_options(self.browser)()
if self.headless: if self.headless:
try: match self.browser:
options.headless = True case "chrome":
except AttributeError: options.add_argument("--headless=new")
pass # Only Chrome and Firefox support the headless mode. case "firefox":
options.add_argument("-headless")
return options return options
def create_webdriver(self): def create_webdriver(self):