screen_size
Resolution of the session's own display (headful only).
Use it for: Responsive and visual tests at a given resolution, and personas that need a common desktop or laptop screen instead of the server default.
Browsers: Google Chrome, Microsoft Edge, Brave, Opera, Naver Whale, Yandex Browser, Chromium, Patchright, Rebrowser, Camoufox, Firefox, WebKit.
Details
- Type:
"WxH" | { width, height } - Default: the server's display (1280×720 window)
- Example:
{"screen_size":"1366x768"}
Sets the screen the browser runs on, from 640×480 to 3840×2160, e.g. "1366x768" or { "width": 1920, "height": 1080 }. Pages see it as screen.width/height; Chromium windows open at that size (Playwright then resizes each context's window to its viewport — use viewport: null to keep the full display, in live view and recordings too); Camoufox pins its fingerprint screen to it unless you pass screen.
Headful sessions only — a headless launch with screen_size returns 400. Playwright contexts report a screen equal to their viewport (1280×720) unless you open them with viewport: null (Python no_viewport=True, Java setViewportSize(null), C# ViewportSize = ViewportSize.NoViewport, Go NoViewport: playwright.Bool(true)); Camoufox always reports the display — the nearest real-world screen size no larger than it (exact for common sizes such as 1366×768 or 1920×1080); with "os": "macos" use 1440×900 or larger, since no Mac screen is smaller (400 otherwise).
Used in
All options: launch options.