Browser and device contexts
Chromium, Firefox, WebKit, plus emulated devices with coherent viewports, touch support, scale factors, and user agents.
- Presets Apply a coherent device preset
- Touch Touch is available when the context enables it
- Context, not browser Locale, timezone, color scheme, geolocation
Apply a coherent device preset
The registry keeps viewport, user agent, scale factor, touch, and mobile flags together. Pass the preset to the context instead of maintaining each option separately.
Devices package →$iPhone = (new DeviceRegistry())->get('iPhone 15 Pro');
$context = Playwright::webkit([
'context' => $iPhone->toArray(),
]);Touch is available when the context enables it
A touch-enabled context exposes touchscreen input and locator taps. Use tap() when touch behavior matters; keep click() for pointer interaction.
Locale, timezone, color scheme, geolocation
Emulation is set per context, so one browser can run a French mobile user and an English desktop one side by side in the same script.
Browsers and contexts →Move from the tour to working code.
Choose the explanation, recipe, or runnable example that matches what you need next.