Implementation:Microsoft Playwright Device Descriptors Source
| Knowledge Sources | |
|---|---|
| Domains | Device Emulation, Testing Configuration |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
A JSON data file containing device emulation profiles that Playwright uses to simulate mobile phones, tablets, and other devices during browser testing.
Description
deviceDescriptorsSource.json is the authoritative catalog of device definitions available via playwright.devices. Each entry maps a human-readable device name (e.g., "iPhone 14", "Pixel 7", "Galaxy S9+") to a descriptor object containing the user agent string, viewport dimensions, device scale factor, touch/mobile flags, and default browser type. The file includes both portrait and landscape variants for most devices. At approximately 1,779 lines, it covers a comprehensive range of devices from Blackberry PlayBook through modern iPhones, iPads, Galaxy devices, Pixel phones, and desktop browser profiles.
Data Schema
Each device entry follows this structure:
{
"<Device Name>": {
"userAgent": "<string>", // Full User-Agent header string
"viewport": {
"width": <number>, // Viewport width in CSS pixels
"height": <number> // Viewport height in CSS pixels
},
"deviceScaleFactor": <number>, // Device pixel ratio (e.g., 1, 2, 3)
"isMobile": <boolean>, // Whether to emulate a mobile device
"hasTouch": <boolean>, // Whether touch events are enabled
"defaultBrowserType": "<string>" // One of "chromium", "firefox", "webkit"
}
}
Example Entry
"Blackberry PlayBook": {
"userAgent": "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) ...",
"viewport": {
"width": 600,
"height": 1024
},
"deviceScaleFactor": 1,
"isMobile": true,
"hasTouch": true,
"defaultBrowserType": "webkit"
}
Device Categories
The file includes profiles for:
- Blackberry: PlayBook, Z30
- Galaxy: Note 3, Note II, S III, S5, S8, S9+, Tab S4
- Google: Pixel 2/2 XL, Pixel 3/3 XL, Pixel 4/4a, Pixel 5, Pixel 7
- Apple iPhone: iPhone 6/7/8 (and Plus), iPhone SE, iPhone X/XR, iPhone 11/12/13/14/15 (and Pro/Pro Max/Mini variants)
- Apple iPad: iPad, iPad Mini, iPad Pro (various generations)
- Microsoft: Surface Pro 7, Surface Duo
- Other: Kindle Fire HDX, LG Optimus, Nexus, Nokia, Moto G4
- Desktop: Desktop Chrome, Desktop Edge, Desktop Firefox, Desktop Safari
Most devices include both portrait and landscape orientations.
Usage
This file is loaded at runtime by playwright-core's server module and exposed through the playwright.devices API. Test authors reference device names to configure browser contexts with realistic device emulation:
const { devices } = require('playwright');
const iPhone = devices['iPhone 14'];
const context = await browser.newContext({
...iPhone,
});
The file is a static data reference and should be updated when new device profiles need to be added to Playwright's supported device catalog.
Code Reference
Source Location
- Repository: Microsoft_Playwright
- File:
packages/playwright-core/src/server/deviceDescriptorsSource.json