Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk6 min

How to Automate Responsive Website Screenshots with Playwright Projects

Run one Playwright screenshot suite across browser and mobile viewport projects, with guidance on baselines, full-page capture, repeatability, and emulation limits.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Playwright Test projects to run the same screenshot test across selected browser engines and mobile or custom viewport configurations. Configure the matrix in playwright.config.ts, then use page.screenshot() to save an image or toHaveScreenshot() to check it against a visual baseline. These projects emulate browser and device settings; they do not prove how a page behaves on physical mobile hardware.

Configure projects for responsive screenshot coverage

A Playwright Test project is a logical group of tests with its own configuration. Projects can run the same test files with different browsers, device profiles, viewports, or other settings. This makes a project matrix useful for checking whether the same page remains usable and visually consistent under chosen conditions. See the Playwright projects guide.

As an Amazon Associate I earn from qualifying purchases.

Install Playwright Test and its browser binaries if they are not already installed in your project. The example below uses the standard Playwright Test runner and imports browser/device settings from @playwright/test.

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

export default defineConfig({
  testDir: './tests',
  projects: [
    {
      name: 'chromium-desktop',
      use: {
        ...devices['Desktop Chrome'],
        viewport: { width: 1440, height: 900 },
      },
    },
    {
      name: 'firefox-desktop',
      use: {
        ...devices['Desktop Firefox'],
        viewport: { width: 1440, height: 900 },
      },
    },
    {
      name: 'webkit-desktop',
      use: {
        ...devices['Desktop Safari'],
        viewport: { width: 1440, height: 900 },
      },
    },
    {
      name: 'mobile-chrome',
      use: {
        ...devices['Pixel 7'],
      },
    },
    {
      name: 'mobile-safari',
      use: {
        ...devices['iPhone 13'],
      },
    },
  ],
});

Device preset names and available configurations are maintained by Playwright and can change. Check the emulation guide for current profiles and supported settings. In the desktop examples, the explicit viewport follows the spread preset so it overrides the preset dimensions.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Choose a device profile or an exact breakpoint

Use a profile for representative mobile emulation

A device profile is more than a screenshot width. Depending on the profile, Playwright can simulate a user agent, screen size, viewport, and touch behavior. Browser context settings can also emulate properties such as locale, timezone, geolocation, permissions, and color scheme. That helps test responsive layouts and browser-dependent behavior under a defined configuration; it is still emulation, not a physical phone.

Set the viewport for a design breakpoint

When a test needs to target an exact responsive breakpoint, configure viewport explicitly in the project. For example, use the width and height specified by your design or QA coverage plan. Configuration is the clearer choice when that size is a stable test condition. Use await page.setViewportSize({ width: 768, height: 1024 }) inside a test when one scenario deliberately changes widths at runtime.

When spreading a device profile and then changing viewport, put viewport after ...devices['Profile Name']. Otherwise the later-spread profile may replace the dimensions you intended.

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

Run the full matrix or one project

Run all configured projects from the project directory:

npx playwright test

For faster iteration, select one project by its configured name:

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
npx playwright test --project=mobile-chrome

Project names also help keep screenshot baselines separate when the same test runs under multiple configurations. Choose the matrix deliberately: adding browser and viewport combinations expands coverage, but also adds test runs and baseline images to maintain. Playwright does not prescribe a universal matrix; prioritize the browsers and responsive widths that matter to your site.

Save screenshots or assert against visual baselines

Save a screenshot file

Use page.screenshot() when the test should produce an image artifact rather than pass or fail on a visual comparison.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
// tests/homepage.spec.ts
import { test } from '@playwright/test';

 test('save the homepage screenshot', async ({ page }) => {
  await page.goto('https://example.com');
  await page.screenshot({ path: 'artifacts/homepage.png' });
});

By default, this captures the current viewport. To capture the full scrollable document, set fullPage: true:

await page.screenshot({ path: 'artifacts/homepage-full.png', fullPage: true });

Viewport capture answers “what is visible at this size?” Full-page capture answers “what does the document look like from top to bottom?” Use the mode that matches the defect or acceptance check. The Page API documents screenshot options, including scale: 'css' outputs one pixel per CSS pixel, while 'device' outputs one pixel per device pixel and can produce larger files on high-DPI profiles.

Compare a visual baseline

Use toHaveScreenshot() when the screenshot itself is a regression assertion. It is a Playwright Test assertion, not a general-purpose method on every Playwright setup.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.
// tests/homepage.visual.spec.ts
import { test, expect } from '@playwright/test';

test('homepage matches its visual baseline', async ({ page }) => {
  await page.goto('https://example.com');
  await expect(page).toHaveScreenshot('homepage.png');
});

The first run creates a reference screenshot; later runs compare against it. When projects are configured, snapshot naming can include project names to keep the configurations’ references distinct. Playwright’s visual comparisons guide describes controls including maxDiffPixels and stylesheet filtering.

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

Use comparison tolerance only for variation you have decided is acceptable. A broad tolerance can conceal a real layout regression. If a proposed baseline changes, inspect the image difference and update the reference only when the new appearance is intended.

Make screenshot checks repeatable

Playwright warns that “Browser rendering can vary based on the host OS, browser version, settings, hardware, power source (battery vs. power adapter), headless mode, and other factors.” For stable visual comparisons, create and compare baselines in a consistent environment, including the same operating system and browser version where practical.

  • Keep the browser, operating system, and test settings consistent between baseline creation and comparison.
  • Control genuinely dynamic content, such as timestamps or rotating promotions, with test data or appropriate masking and styling options.
  • Use stylesheet filtering or masks for volatile regions only when those regions are intentionally outside the visual assertion.
  • Review changed screenshots instead of accepting every new output as the correct baseline.
  • Decide whether the test is viewport-only or full-page before interpreting a difference.

What responsive emulation establishes—and what it does not

Project-based emulation lets the same tests exercise selected browser configurations, screen and viewport dimensions, touch behavior, and other supported context settings. It is a practical way to catch layout and visual changes across a planned matrix without requiring a physical device for each run.

It does not establish that the page behaves identically on real mobile hardware. Playwright documents a separate Android API, labeled experimental, that requires an Android device or AVD; that is not required for the project-based emulation workflow. See the Android API documentation if physical Android testing is a separate requirement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common screenshot-test failures

A project name is not recognized

Check that the value after --project= exactly matches a project’s name in playwright.config.ts. Run npx playwright test to verify the configuration is being loaded and the configured projects run.

The captured width does not match the intended breakpoint

Check where viewport appears in the use object. If you spread a device preset, put the explicit viewport after the spread. Also check whether the test changes the viewport later with page.setViewportSize().

The screenshot includes only the visible portion of the page

That is the default viewport capture. Set fullPage: true when the whole scrollable document is the intended artifact. If the test concerns an initial mobile view, leave it off.

A visual test fails even though the code did not change

Rendering can vary with the host OS, browser version, settings, hardware, power source, and headless mode. Compare in a consistent environment, inspect the diff, and control dynamic content. Do not raise tolerances automatically; first determine whether the change is noise or a real visual regression.

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

Baseline images seem to overwrite or mix across projects

Confirm that each project has a distinct name and review the generated snapshot paths. Playwright supports including project names in snapshot names, which is useful when the same visual assertion runs in several configurations.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Or skip the browser setup

If you need a screenshot API rather than a Playwright test matrix, ScreenshotNeo returns a PNG, JPEG, WebP, or PDF from one GET request. Its clean-shot steps can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

Example cURL request (replace YOUR_API_KEY with your key):

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 parameters and response details. Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

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

Frequently Asked Questions

Can I run only the mobile screenshot configuration?

Yes. Use the project’s exact configured name with `npx playwright test –project=`, such as `npx playwright test –project=mobile-chrome`.

Does Playwright’s mobile profile test a real phone?

No. Device profiles emulate browser and device parameters. Physical-device testing is a separate workflow.

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.

Leave a Reply

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

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.

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
Windows Errors? Fix Them Before They SpreadFree repair 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.