-
Book Overview & Buying
-
Table Of Contents
Hands-On Automated Testing with Playwright
By :
Device emulation in Playwright lets you mimic how your website behaves on smartphones, tablets, and even various desktop setups. Device emulation does more than just resizing your browser window. It can simulate a full range of properties. Emulation also comes in handy for checking how touch interactions work (things like swipes, taps, and even virtual keyboards).
Playwright comes with a predefined list of common device descriptors, which makes emulation very convenient. The full list of predefined devices is maintained in the source code available on Github:https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.jsonYou can also see what predefined devices Playwright offers inside your code, without having to go to external docs or GitHub:
import { devices } from '@playwright/test';
console.log(devices);
This will log all the available device descriptors you...