diff options
| author | Nick Pope <nick@nickpope.me.uk> | 2024-05-09 18:03:31 +0100 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-05-13 17:31:35 +0200 |
| commit | 53b981eff2d168d92de31182b186827aecd88b8b (patch) | |
| tree | 912741e4aad39d54eb50dd65b824686dedb5820c | |
| parent | a09082a9bec18f8e3ee8c10d473013ec67ffe93b (diff) | |
Added support for using Microsoft Edge with Selenium.
| -rw-r--r-- | django/test/selenium.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/django/test/selenium.py b/django/test/selenium.py index 2840afb9ec..db6c78a96b 100644 --- a/django/test/selenium.py +++ b/django/test/selenium.py @@ -83,7 +83,7 @@ class SeleniumTestCaseBase(type(LiveServerTestCase)): options = self.import_options(self.browser)() if self.headless: match self.browser: - case "chrome": + case "chrome" | "edge": options.add_argument("--headless=new") case "firefox": options.add_argument("-headless") @@ -194,10 +194,12 @@ class SeleniumTestCase(LiveServerTestCase, metaclass=SeleniumTestCaseBase): self.selenium.execute_script("localStorage.removeItem('theme');") def set_emulated_media(self, features, media=""): - if self.browser != "chrome": - self.skipTest("Emulated media controls are only supported on Chrome.") - # Chrome Dev Tools Protocol Emulation.setEmulatedMedia - # https://chromedevtools.github.io/devtools-protocol/1-3/Emulation/#method-setEmulatedMedia + if self.browser not in {"chrome", "edge"}: + self.skipTest( + "Emulation.setEmulatedMedia is only supported on Chromium and " + "Chrome-based browsers. See https://chromedevtools.github.io/devtools-" + "protocol/1-3/Emulation/#method-setEmulatedMedia for more details." + ) self.selenium.execute_cdp_cmd( "Emulation.setEmulatedMedia", {"media": media, "features": features} ) |
