Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

How to Take a Mobile Website Screenshot with Playwright

Use a Playwright device profile to emulate a mobile browser, then capture the viewport or full page with page.screenshot().
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture a mobile website with Playwright, create a browser context using a mobile device profile, open the page, and call page.screenshot(). The profile emulates settings such as viewport, user agent, and touch behavior; it does not make the context a physical phone. Use fullPage: true for the full scrollable page, or omit it to capture only the visible viewport.

Choose a mobile device profile

Playwright’s device presets configure browser characteristics such as user agent, screen size, viewport, and touch behavior. Choose a preset that matches the browser engine and platform you want to emulate. The available profiles can change, so check the current Playwright emulation documentation for the current device list and configuration details.

As an Amazon Associate I earn from qualifying purchases.

For a Playwright Test project, add a project whose use settings spread the chosen device profile:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  projects: [
    {
      name: 'mobile-chrome',
      use: { ...devices['Pixel 7'] },
    },
  ],
});

Use a preset appropriate to your target rather than assuming every mobile preset represents the same browser or operating system. If you need a custom viewport, put it after the spread so your value overrides the preset’s viewport:

#1 Best Overall
Sale
Motorola Moto g - 2026 | Unlocked | Made for US 4/128GB | 50MP Camera | Pantone Slipstream, Cellular_Phone
  • 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.****
use: {
  ...devices['iPhone 13'],
  viewport: { width: 390, height: 844 },
}

Capture a screenshot in a Playwright Test

In a test running under the configured project, navigate to the page and save the visible viewport:

import { test, expect } from '@playwright/test';

test('capture mobile page', async ({ page }) => {
  await page.goto('https://example.com');
  await page.screenshot({ path: 'mobile.png' });
});

The default screenshot is the current viewport. To capture the entire scrollable page instead, set fullPage: true:

Rank #2
Sale
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black | Large AMOLED, High-Res Camera, Durable Design, Super Fast Charging, Expandable Storage, Circle to Search, 2025
  • 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.
await page.screenshot({ path: 'mobile-full.png', fullPage: true });

A full-page image can be much taller than a phone screen; use it when you need page coverage, not when the goal is to show exactly what fits on screen. The Playwright screenshots guide also describes capturing a single element when you need an isolated component instead of the whole page.

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

Run a standalone Node.js script

For a one-off capture outside Playwright Test, create a browser context from a device profile, open a page, and close the context and browser when finished. Install Playwright and its browser binaries for your project before running this script.

Rank #3
Samsung Galaxy A16 5G 128GB Cell Phone, Unlocked Android Smartphone, Large AMOLED Display, Durable Design, Super Fast Charging, Expandable Storage, US Version, 2025, Blue Black (Renewed)
  • 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.
import { chromium, devices } from 'playwright';

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

try {
  await page.goto('https://example.com');
  await page.screenshot({ path: 'mobile.png' });
  await page.screenshot({ path: 'mobile-full.png', fullPage: true });
} finally {
  await context.close();
  await browser.close();
}

If you override a profile setting in newContext(), put the custom value after ...iphone13 so it takes precedence. The context pattern is documented in the emulation guide.

Pick the screenshot extent and scale

Choice What it captures When to use it
Viewport (default) The visible browser viewport When you want a phone-screen view of the page
fullPage: true The full scrollable page When you need to inspect or share content beyond the initial screen
scale: 'css' One image pixel per CSS pixel When you want a compact image at CSS-pixel scale
scale: 'device' Device-pixel output When you need high-DPI detail and can accept a potentially larger file

The Page API documents device as the default screenshot scale. Set the scale explicitly if image dimensions or file size matter to your workflow:

Rank #4
Sale
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue | Large AMOLED, High-Res Camera, Durable Design, Super Fast Charging, Expandable Storage, Circle to Search, 2025
  • 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.
await page.screenshot({ path: 'mobile-css-scale.png', scale: 'css' });

See the Page API screenshot options for the current option behavior.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Wait for the page content you need

A navigation completing does not guarantee that every site-specific element or image is ready for capture. Wait for a meaningful selector or known content that matters to the screenshot instead of relying on a universal fixed delay:

Best Value
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.
await page.goto('https://example.com');
await page.locator('[data-testid="main-content"]').waitFor();
await page.screenshot({ path: 'mobile.png' });

Replace the selector with one the target site actually renders. The relevant readiness condition depends on the page; Playwright’s screenshot documentation does not establish one delay or wait rule that works for every site.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use screenshot assertions for visual regression

For repeatable checks, Playwright Test can compare screenshots against stored reference images. Keep the comparison environment stable: operating system, browser version, browser settings, hardware, power source, and headless mode can all affect rendering. A baseline captured in one environment may differ from a run in another even when the page code has not changed. See Playwright visual comparisons for the assertion workflow and its environment guidance.

When emulation is not enough

Mobile emulation is the practical choice for responsive layouts and ordinary mobile screenshots. It changes browser characteristics but does not reproduce all behavior of physical hardware. If you must validate real Android browser behavior, Playwright has a separate Android automation workflow for Chrome for Android and Android WebView. That workflow is marked experimental and requires an Android device or AVD emulator plus supporting Android setup; consult the Android API documentation before choosing it.

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

Or skip the browser setup

For a one-request screenshot without setting up a Playwright browser context, use ScreenshotNeo, a website screenshot API and MCP server for developers:

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 for request options. ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server offers screenshot tools for AI agents, including Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Learn more at ScreenshotNeo.

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

Troubleshoot common capture problems

  • The image is desktop-sized: Check that the test is running in the project with the mobile profile, or that the standalone context was created from the intended device preset.
  • Your viewport override has no effect: Put the override after the spread of the device profile so it takes precedence.
  • The screenshot is cut off below the first screen: The default captures the viewport. Set fullPage: true for the full scrollable page.
  • Content is missing or still loading: Wait for the specific element or content needed in the image. A fixed delay cannot guarantee readiness across different sites.
  • The output file is larger than expected: Check whether device-pixel scale is in use. Set scale: 'css' for one image pixel per CSS pixel.
  • Visual assertions differ across machines: Run baseline creation and comparisons in the same rendering environment, including browser version and headless mode.

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.

Free tools Windows power users keep installed

One-click scans. No signup required.

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
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.