browser_emulate_device
Emulate any iPhone, iPad, or Android device in the browser to test responsive layouts. Preserves auth state and returns to the current page after swapping devices.
Instructions
Switch the browser session into a device emulation profile (iPhone / iPad / Android tablet / desktop reset / custom). Emulation lives on the browser context — it persists across browser_navigate calls until you swap to another device or call browser_restart.
IMPORTANT behaviors: • Swapping devices recreates the browser context but cookies + localStorage are PRESERVED (via persistent storageState). Pages behind auth stay logged in across swaps. The tool auto-navigates back to the URL you were on. IndexedDB is not preserved — PWAs that store auth tokens there may require re-login. • innerWidth: 980 on a mobile emulation is NOT a bug. It means the current page has no and is using Chrome's legacy fallback. Check verified.layout_mode — it will be "legacy-980-fallback" in this case. The authoritative signals that emulation is working are: userAgent, pointer_coarse, hasTouch, devicePixelRatio. • browser_restart always clears emulation (back to desktop). • Not supported in REAL_CHROME mode (returns an error).
Presets and natural viewports (portrait): • iphone-15-pro-max (430×932), iphone-15-pro (393×852), iphone-15 (393×852), iphone-se (375×667) • galaxy-s24 (360×800) • ipad-pro-13 (1024×1366), ipad-pro-11 (834×1194), ipad-mini (768×1024) • galaxy-tab-s9 (800×1280) • desktop-chrome (1280×800, DPR 1, no touch — use this to reset) • custom — requires custom.userAgent + custom.viewport.{width,height}
Returns { ok, active, previous_url, previous_url_restored, verified, checks, warnings? }. ok: true as long as the essential fields (UA substring + devicePixelRatio) match; soft drift in hasTouch or pointer_coarse surfaces as warnings[] without flipping ok. On hard failure: { ok: false, error, verified, checks }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| custom | No | Required iff device === 'custom'. Must include userAgent and viewport.{width,height}. | |
| device | Yes | Device preset key, or 'custom' to supply your own options. | |
| orientation | No | Optional. Defaults to the device's natural orientation. Swaps viewport + screen width/height. |