Reputation: 175
Where can I find a full list of devices enabled to be used for emulation with Playwright testing
Upvotes: 1
Views: 11269
Reputation: 175
Its not easy to find but here is the full list. The list is also obtainable by logging the devices
variable.
Example :
const { chromium, devices } = require('playwright');
const iPhone11Pro = devices['iPhone 11 Pro'];
(async () => {
const browser = await chromium.launch({
headless: false,
});
const context = await browser.newContext({
viewport: iPhone11Pro.viewport,
userAgent: iPhone11Pro.userAgent,
});
const page = await context.newPage();
await page.goto('https://apple.com');
console.log(devices); // Logs all devices
await context.close();
await browser.close();
})();
Upvotes: 6
Reputation: 69
An update of the answer by @akwasiijunior
You can view the current full list of devices here:
You can also view it by installing Playwright, and printing it from a test, like so:
npm install -D @playwright/test
echo "const { devices } = require('@playwright/test'); console.log(devices)" > devices.spec.js
npx playwright test devices.spec.js
Upvotes: 3