October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Capture Mobile Web Screenshots with Playwright Device Descriptors

Use Playwright device descriptors to configure mobile browser emulation, then capture viewport or full-page screenshots with intentional dimensions and scale.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Playwright’s named device descriptor to configure a browser context, then capture the page with page.screenshot(). The descriptor supplies emulation settings such as viewport, user agent, and touch capability; it does not take the screenshot on a physical phone. The example below captures a full-page image using the Playwright browser context configured for an iPhone preset.

Capture a mobile screenshot with a device descriptor

In a standalone Node.js script, import chromium and devices from Playwright, spread a descriptor into browser.newContext(), open the target URL, and call page.screenshot().

As an Amazon Associate I earn from qualifying purchases.

import { chromium, devices } from 'playwright';

const browser = await chromium.launch();
try {
  const context = await browser.newContext({
    ...devices['iPhone 13'],
  });
  const page = await context.newPage();

  await page.goto('https://example.com');
  await page.screenshot({
    path: 'mobile-page.png',
    fullPage: true,
    scale: 'css',
  });

  await context.close();
} finally {
  await browser.close();
}

The iPhone 13 descriptor is an example from Playwright’s documentation, not a guarantee that every installed Playwright version has the same registry. Check the devices object in your project’s installed version. See Playwright’s emulation guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the descriptor in Playwright Test

For a test project, spread the same descriptor into the project’s use settings:

#1 Best Overall
Sale
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black
  • 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.
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  projects: [
    {
      name: 'Mobile Safari',
      use: { ...devices['iPhone 13'] },
    },
  ],
});

Use the descriptor name and browser configuration available in the Playwright version installed by your project. The project configuration applies the emulation settings to tests in that project.

Choose a preset or set a custom viewport

A device descriptor provides a bundle of settings, including viewport and simulated device characteristics. To keep the descriptor’s other settings but change its viewport, put viewport after the spread so the custom value overrides the preset:

Rank #2
Tracfone Motorola Moto G 2025, 64GB, Saphire Blue (Locked to
  • 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.
const context = await browser.newContext({
  ...devices['iPhone 13'],
  viewport: { width: 390, height: 844 },
});

Those dimensions are now your test configuration, not an unmodified device preset. You can also change the viewport on an existing page with page.setViewportSize(). When you want to reproduce the descriptor as documented, avoid silently replacing related mobile settings such as isMobile or touch configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose what the screenshot captures and its pixel scale

page.screenshot() captures the current viewport by default. Set fullPage: true to capture the full scrollable page. Set a file path and Playwright infers the image type from the extension.

Rank #3
Sale
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue
  • 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.
Choice Setting What it means
Current viewport Omit fullPage or set it to false Captures the visible viewport.
Full scrollable page fullPage: true Captures the page beyond the visible viewport.
CSS-pixel output scale: 'css' One output image pixel per CSS pixel.
Device-pixel output scale: 'device' Uses device-pixel resolution; high-DPI output can be larger. This is the documented default.

Set the scale explicitly when consistent review-image dimensions matter. For example:

await page.screenshot({ path: 'viewport.png' });
await page.screenshot({ path: 'entire-page.png', fullPage: true });
await page.screenshot({ path: 'review.png', fullPage: true, scale: 'css' });

Screenshot options and their behavior are documented in the Playwright Page API.

Rank #4
Sale
Samsung Galaxy S26 Ultra, Unlocked Android Smartphone, 512GB, Black
  • PRIVACY DISPLAY: Automatically hide your screen from those beside you. The built-in privacy display can be preset¹ to turn on when receiving notifications, typing passwords, or using specific apps
  • TYPE IT IN. TRANSFORM IT FAST: Enhance any shot in seconds on your smartphone by using Photo Assist² with Galaxy AI.³ Add objects, restore details, or apply new styles by simply typing or tapping
  • NIGHTS, CAPTURED CLEARLY: From gigs to city lights, record and capture moments after dark with clarity using Nightography so your photos and videos stay crisp and clear on your Samsung Galaxy
  • MAKE IT. EDIT IT. SHARE IT: Turn everyday moments into something personal with creative tools built right into your mobile phone, whether it’s a special contact photo, custom wallpaper, an invitation or more⁴
  • HELP THAT KEEPS UP: Stay in the moment while Now Nudge with Galaxy AI helps you respond faster and stay organized with smart suggestions⁵ that appear exactly when you need them on your phone
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Understand what the screenshot represents

A descriptor configures browser emulation; it does not certify how a site behaves on physical hardware. Playwright emulates parameters such as user agent, viewport, screen size, and touch capability. Validate on an actual device separately if hardware-specific behavior matters.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Mobile behavior and user agent

The descriptor’s isMobile setting affects whether the page’s meta viewport tag is taken into account and enables touch events. The mobile preset includes this option, so changing it changes the configuration you are testing.

Best Value
Tracfone Moto g Play 2024 Prepaid Phone with a 1-Yr Plan Included
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Activating is easy, just 3 steps.
  • ACTIVATION Promotion: Includes 1500 min, 1500 texts & 1500 MB Data + add more as you need it
  • CAMERA SYSTEM: 50MP Quad Pixel camera. Capture sharper, more vibrant photos day or night with 4x the light sensitivity.
  • PERFORMANCE: Blazing-fast Qualcomm performance. Get the speed you need for great entertainment with a Snapdragon 680 processor and 4GB of RAM.
  • 64GB built-in storage. Get plenty of room for photos, movies, songs, and apps. Made for US

Presets can also make platform assumptions. For example, Playwright’s Desktop Chrome preset supplies a Windows-specific user agent. If the host platform’s user agent is what you intend to test, the emulation guide recommends unsetting the preset’s userAgent. Make overrides explicit so someone interpreting the screenshot knows which browser characteristics were simulated.

Troubleshoot common problems

  • The descriptor name is missing. Device registry contents can differ between installed Playwright versions. Inspect the installed devices object and use a name it contains.
  • The screenshot has unexpected dimensions. The descriptor supplies a viewport unless you override it. Check whether a custom viewport appears after the spread, and whether you chose CSS or device scale.
  • The image shows only the visible area. Viewport capture is the default. Set fullPage: true when you need the scrollable page.
  • Mobile layout or touch behavior differs from expectation. Check the descriptor’s mobile settings, including isMobile, viewport, and touch capability; do not assume a screenshot represents a physical phone.
  • The user agent looks wrong for the host machine. A preset may supply its own platform-specific user agent. If you need the host user agent, unset the descriptor’s userAgent as described in the emulation guide.

Or skip the browser setup

ScreenshotNeo can return a screenshot from one GET request. For example, capture the example page as WebP:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo API documentation. It removes cookie banners, newsletter popups, and chat widgets before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. See ScreenshotNeo for the service details.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Sign up for 1,000 free screenshots a month, with no card.

Frequently Asked Questions

Does a Playwright device descriptor run the page on a real phone?

No. It configures browser emulation. Use separate real-device validation when behavior on physical hardware matters.

Does Playwright capture the full page by default?

No. The default screenshot is the current viewport; set fullPage: true to capture the scrollable page.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.