MCPcopy
hub / github.com/django/django / set_emulated_media

Method set_emulated_media

django/test/selenium.py:206–224  ·  view source on GitHub ↗
(self, *, media=None, features=None)

Source from the content-addressed store, hash-verified

204 self.selenium.execute_script("localStorage.removeItem('theme');")
205
206 def set_emulated_media(self, *, media=None, features=None):
207 if self.browser not in {"chrome", "edge"}:
208 self.skipTest(
209 "Emulation.setEmulatedMedia is only supported on Chromium and "
210 "Chrome-based browsers. See https://chromedevtools.github.io/devtools-"
211 "protocol/1-3/Emulation/#method-setEmulatedMedia for more details."
212 )
213 params = {}
214 if media is not None:
215 params["media"] = media
216 if features is not None:
217 params["features"] = features
218
219 # Not using .execute_cdp_cmd() as it isn't supported by the remote web
220 # driver when using --selenium-hub.
221 self.selenium.execute(
222 driver_command="executeCdpCommand",
223 params={"cmd": "Emulation.setEmulatedMedia", "params": params},
224 )
225
226 @contextmanager
227 def high_contrast(self):

Callers 1

high_contrastMethod · 0.95

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected