Use a Playwright device preset when you want a coherent mobile-browser profile, or set the CSS viewport directly when you want to test a particular responsive breakpoint. Run those configurations as Playwright Test projects, and generate and compare visual baselines in a consistent environment. Emulation is useful for mobile layout checks; connected Android testing is a separate option when you need to validate Android Chrome or WebView on hardware.
How do I take screenshots at mobile viewport sizes in Playwright?
For repeatable visual tests, configure a mobile profile as a Playwright Test project and use expect(page).toHaveScreenshot(). A device preset supplies a bundle of browser settings; a viewport override lets you deliberately test a page width and height. You can use either, or spread a preset first and override only the values relevant to your test.
As an Amazon Associate I earn from qualifying purchases.
Use a device preset for a coherent mobile profile
Playwright provides a devices registry of descriptors for selected desktop, tablet, and mobile profiles. A descriptor may include browser-related settings such as user agent, screen and viewport dimensions, touch capability, and mobile behavior. For example, the documented Pixel 5 profile can be applied to a project like this:
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
projects: [
{
name: 'mobile-chrome',
use: { ...devices['Pixel 5'] },
},
],
});
Device names are examples, not a promise that the registry is fixed or exhaustive. Check the registry in the Playwright version installed in your project. The preset simulates browser properties; it does not guarantee the same rendering as a physical phone.
#1 Best Overall
- Universal unlocked. Compatible with all major U.S. carriers, including Verizon, AT&T, T-Mobile and other prepaid carriers.
- Super-bright, super-smooth 6.7" display. See your screen clearly even outdoors in sunlight, and enjoy seamless views with a fast-refreshing 120Hz display.*
- AI-powered camera system. Take stunning photos in any light with the 50MP camera**, look your best with a 32MP selfie cam*****, and capture extreme close-ups.
- Superfast 5G performance. Unleash your entertainment at 5G speed*** with the MediaTek Dimensity 6300 chipset and up to 12GB of RAM with RAM Boost****.
- Long-lasting battery + TurboPower charging. Power through day after day with a 5200mAh battery, then get hours of power in just minutes.****
Override the viewport when breakpoint coverage is the goal
Responsive CSS reacts to the CSS viewport, so set the viewport dimensions to the breakpoint or page size you intend to cover. You can override a preset in project options by putting your chosen value after the spread:
use: {
...devices['Pixel 5'],
viewport: { width: 390, height: 844 },
}
The dimensions above are an illustrative test choice, not a universal recommended phone size. Choose dimensions from your supported layout breakpoints and user audience. Alternatively, set a page’s viewport during a test with await page.setViewportSize({ width: 390, height: 844 }). For context-level setup, pass viewport settings to browser.newContext().
Keep pixel density distinct from CSS viewport size
deviceScaleFactor controls device-pixel density, while viewport width and height describe the CSS layout area. If your test is about responsive CSS, choose the CSS viewport deliberately. Add a device scale factor only when screenshot pixel density itself matters, and keep it consistent between baseline creation and comparison.
Know what mobile emulation changes
The isMobile setting controls whether the page’s meta viewport tag is taken into account and enables touch events. A preset may already provide mobile-specific values, so avoid adding duplicate or conflicting settings without a reason. Playwright also supports emulated conditions such as locale, timezone, geolocation, permissions, and color scheme; configure only the conditions that affect the behavior under test. See the Playwright emulation guide for available options and current device descriptors.
Rank #2
- YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
- LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
- MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
- NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
- BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
How should I organize desktop and mobile screenshot projects?
Projects let the same test suite run under distinct browser and device configurations. A small, intentional matrix is easier to interpret and maintain than running every possible combination. This illustrative configuration includes desktop browser engines and two mobile-emulation profiles:
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
projects: [
{
name: 'desktop-chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'desktop-firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'desktop-webkit',
use: { ...devices['Desktop Safari'] },
},
{
name: 'mobile-chrome',
use: { ...devices['Pixel 5'] },
},
{
name: 'mobile-safari',
use: { ...devices['iPhone 12'] },
},
],
});
These project names and profile labels follow documentation examples and may need adjustment for the installed Playwright version. Select projects based on the browsers and layouts your product supports. The Playwright projects guide explains project configuration and selection; the browser guide covers browser engines and channels, including branded browser options.
Run all configured projects or select one
By default, Playwright Test runs the configured projects. To focus on one project, use its configured name:
npx playwright test --project=mobile-chrome
Replace mobile-chrome with the name in your own configuration. Choose projects around meaningful risk: browser engine, supported viewport breakpoints, mobile touch or viewport behavior, and whether a branded Chrome or Edge channel is specifically needed.
Rank #3
- Charger NOT Included, 6.7" Super AMOLED FHD+, 90Hz Refresh Rate, 385 ppi, 800 nits (HBM), 1080x2340px, 5000mAh Battery
- 128GB, 4GB RAM, microSDXC, Exynos 1330 (5nm), Octa-Core, Mali-G68 MP2 or Mali-G57 MC2 GPU
- Rear Camera: 50MP, f/1.8 (wide) + 5MP, f/2.2 (ultrawide) + 2MP, f/2.4 (macro), LED flash, panorama, HDR; Front Camera: 13MP, f/2.0, Android 14, up to 6 major Android upgrades, One UI 6.1
- 3G: HSDPA 850/900/1700(AWS)/1900/2100; 4G LTE: 1/2/3/4/5/7/12/13/14/20/25/26/28/29/30/38/39/40/41/48/66/71, 5G: 2/5/25/41/66/71/77/78 SA/NSA/Sub6/mmWave - Nano-SIM + eSIM
- US Model – Global Connectivity – Compatible with Most GSM Carriers like T-Mobile, AT&T, MetroPCS, etc. Will Also work with CDMA Carriers Such as Verizon, Straight Talk.
How do screenshot baselines work?
Use Playwright Test’s toHaveScreenshot() assertion to create and compare visual references. The first run creates a baseline; later runs compare the captured image with that reference. Review the generated image and add intentional snapshots to source control through your team’s normal process.
import { test, expect } from '@playwright/test';
test('mobile home page matches its visual baseline', async ({ page }) => {
await page.goto('https://example.com');
await expect(page).toHaveScreenshot();
});
Replace the example URL with the page under test. Playwright retries screenshot capture until two consecutive screenshots match, then stores the last capture. This reduces some transient variation, but it cannot make rendering identical across different environments.
Update snapshots only after investigating a diff
When a visual change is intentional, update references with:
Recommended Free Tools
npx playwright test --update-snapshots
Inspect the resulting diffs before accepting them. A failed comparison may indicate a real product regression, an unstable page, or environmental drift. Updating snapshots reflexively can make an unintended change look like an approved baseline.
Rank #4
- YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
- LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
- MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
- NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
- BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
Control known visual noise narrowly
Comparison options include maxDiffPixels and a custom stylesheet through stylePath, which can hide known volatile elements during capture. Scope these controls to identified sources of noise; broad hiding or generous tolerances can conceal genuine layout defects. See the visual comparisons guide for screenshot assertions, options, and baseline workflow.
Why do Playwright screenshot tests fail on CI?
A screenshot mismatch does not automatically mean the page changed. Rendering can vary with host operating system, browser version, browser settings, hardware, power source, and headless mode. The most reliable comparison is between captures made in the same environment, with matching browser and test settings. This is especially important when baselines are created on a developer laptop but checked in CI.
Common symptoms and fixes
| Symptom | Likely cause | What to check |
|---|---|---|
| Small or widespread pixel differences on CI | Baseline and comparison ran under different OS, browser version, settings, hardware, or headless mode. | Generate and compare snapshots in a consistent environment; verify the installed Playwright browser version and run mode. |
| The screenshot changes between repeated runs | Volatile page content or timing-dependent rendering. | Inspect the page for known changing elements and use a narrowly scoped stylePath or other relevant wait condition only for identified noise. |
| A snapshot update clears the failure, but the change is unclear | The reference may be accepting a real regression or masking environment drift. | Review the image diff and determine whether the UI change is intended before updating snapshots. |
| The expected mobile layout does not appear | The test may be using a different CSS viewport, meta-viewport behavior, or device configuration than intended. | Check the project’s preset, any later viewport overrides, and whether isMobile is appropriate for the case. |
For diagnoses, compare the baseline-generation setup with CI rather than assuming a particular CSS defect: confirm OS, browser build, headless setting, viewport, device scale factor, and project selection.
Free tools Windows power users keep installed
One-click scans. No signup required.
When is connected Android testing worth adding?
Emulated projects are the standard route for checking responsive layouts and many mobile-browser conditions. A successful emulated run is not proof that every physical device, operating-system UI, browser build, hardware characteristic, or native-app WebView will behave identically.
Best Value
- Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Tracfone plan required, activating is easy, just 3 steps.
- DISPLAY: Immersive viewing on a 6.7-inch super-bright 120Hz display with powerful stereo speakers and Bass Boost for cinematic entertainment.
- CAMERA SYSTEM: Advanced 50MP Quad Pixel camera captures sharp, detailed photos and videos in any lighting condition
- PERFORMANCE: Lightning-fast 5G connectivity paired with a powerful processor and RAM Boost for smooth multitasking.
- BATTERY LIFE: Long-lasting 5000mAh battery with TurboPower charging technology delivers hours of power in minutes.
Add connected Android automation when a product risk specifically depends on Android Chrome or WebView running on hardware. Playwright’s Android API supports discovering connected devices, launching Chrome or working with WebView, and capturing screenshots; its setup has requirements and limitations. Treat it as a separate validation path, not a prerequisite for viewport emulation. See the Playwright Android API documentation. You can follow the main emulated workflow without buying a phone.
Or skip the browser setup
If you need a screenshot of a URL rather than a Playwright visual-regression test, ScreenshotNeo is a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP, or PDF. It is not a replacement for Playwright’s test runner or snapshot assertions.
See the ScreenshotNeo API documentation for request options. A cURL example:
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minutecurl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
Cookie banners are accepted and removed before capture, along with supported newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server lets AI agents use screenshot tools. The free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots. Sign up free for 1,000 screenshots a month, with no card required.
Frequently asked questions
Can a device preset prove that an iPhone or Android phone will match?
No. It simulates browser properties useful for testing, but does not reproduce every physical device, operating-system UI, browser build, or hardware condition.
Is a real Android device required for mobile viewport screenshots?
No. Use Playwright projects and emulation for the usual responsive screenshot workflow; connected Android automation is optional when hardware-specific Android Chrome or WebView validation matters.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →




