emulate_media
Simulate device and environment conditions by overriding color scheme, motion preferences, print mode, and navigator user agent. Reset to restore real settings.
Instructions
Make the page believe it runs in a different environment, until reset or reload: prefers-color-scheme, prefers-reduced-motion, print mode (matchMedia override + CSS) and navigator.userAgent/platform. user_agent only changes what page JS reads — the request header is a separate thing, set it with network_rules(action=modify_header, header="User-Agent"). Pair with viewport_resize to emulate a device.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| reset | No | Remove all emulations | |
| tab_id | No | Target tab; omitted = last tab navigated in this session, else the active one | |
| printMode | No | Make print media queries match, without opening a print dialog | |
| user_agent | No | Overrides navigator.userAgent and appVersion in the page (not the HTTP header) | |
| colorScheme | No | Value reported to prefers-color-scheme queries | |
| reducedMotion | No | Value reported to prefers-reduced-motion queries |