Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
FREEDOM251

Freedom251 › Blog › browser automation

How to Capture Screenshots of Multiple Pages at Different Viewport Sizes

By Freedom251 Team · · 5 min read

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

Use a browser automation script that loops through a list of page URLs and a list of viewport sizes. Set each viewport before navigating, wait for the page state you need, and save each capture with a filename that identifies its page and dimensions. Choose a viewport screenshot to compare what fits in a fixed window, or a full-page screenshot to record the whole scrollable document.

Build a page-and-viewport capture matrix

Each URL paired with each viewport is one capture. Keep the two lists explicit so you can add pages or sizes without duplicating the capture logic. Choose widths and heights that reflect your site’s responsive breakpoints and the devices you support; there is no universally correct viewport matrix.

As an Amazon Associate I earn from qualifying purchases.

The following JavaScript shows the core Playwright pattern. It is illustrative rather than a tested, production-ready script: configure browser selection, authentication, timeouts, readiness checks, and output directories for your project and installed Playwright version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const pages = [
  { name: 'home', url: 'https://example.com/' },
  { name: 'pricing', url: 'https://example.com/pricing' },
];
const viewports = [
  { name: 'mobile', width: 390, height: 844 },
  { name: 'tablet', width: 768, height: 1024 },
  { name: 'desktop', width: 1440, height: 900 },
];

for (const target of pages) {
  for (const viewport of viewports) {
    const page = await browser.newPage({ viewport });
    await page.goto(target.url);
    await page.screenshot({
      path: `${target.name}--${viewport.name}-${viewport.width}x${viewport.height}.png`,
      fullPage: false,
    });
    await page.close();
  }
}

Here, browser must already be a launched Playwright browser. For a complete script, launch the browser and close it in a finally block so it is cleaned up even if navigation or capture fails. The example creates a page for each pair and sets its viewport at creation, before navigation.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • 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

Set the viewport before loading the page

Playwright’s Page API advises setting the viewport before navigation because some websites do not expect a phone’s size to change after load. A viewport controls the dimensions used for layout; set it first when you want the page to render as it would at those dimensions. See the Playwright Page API.

Wait for the state you intend to capture

Navigation completing does not necessarily mean that application data, images, fonts, or animations have settled. For dynamic pages, wait for an application-specific condition that indicates the relevant content is ready. For example, if a price table appears after a request, wait for that table or another meaningful selector before taking the screenshot. A fixed delay can be useful for a known animation, but it is less reliable than waiting for the state that matters.

Name files for repeatable comparison

Use deterministic names that include a sanitized page identifier, viewport dimensions, and, when relevant, a device or browser label. For example, pricing--mobile-390x844.png and pricing--desktop-1440x900.png make it easier to identify the capture being reviewed. Store captures in a known output directory and avoid names that overwrite another page or viewport.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • 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

Choose viewport or full-page capture

These modes answer different questions. Playwright’s fullPage option captures the full scrollable page; the default is the visible viewport. See the Playwright screenshot guide.

Capture mode Use it for Playwright setting
Visible viewport Checking responsive layout at a fixed window size, including what a user sees without scrolling. fullPage: false (or omit the option)
Full page Recording the entire scrollable document in one image. fullPage: true

For a responsive comparison, keep the viewport height consistent for each width you are comparing unless varying height is part of the test. A full-page capture is not a substitute for checking the initial screen at a defined viewport height.

Decide whether to emulate a device or only set dimensions

A viewport sets layout width and height. Device emulation can also set properties such as device scale factor, touch, mobile mode, screen size, and user agent. Those differences can affect rendering and behavior, so use device emulation when the test requires those properties—not merely because a viewport is called “mobile.” Playwright documents device descriptors and emulation options in its emulation guide.

Rank #3
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.

Playwright contexts can apply viewport configuration to their pages, while individual pages in one browser can have different viewports. One context is convenient when pages share the same settings; separate configurations are easier to reason about when device properties differ. The BrowserContext API and Page API document these controls.

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.

CSS pixels and device pixels are different

The CSS viewport determines the layout dimensions; image pixel dimensions can differ when device scale is involved. Playwright MCP documents scale: "css" for CSS-pixel-sized output and scale: "device" for device-pixel output. A device-scale capture can contain more image pixels without changing the CSS viewport being tested. See the Playwright MCP documentation.

Keep visual comparisons consistent

If captures are visual baselines, keep the browser, operating system, and relevant capture settings consistent. Browser version, operating system, settings, hardware, power source, and headless mode can affect rendering; a screenshot difference does not by itself prove the page changed. Playwright outlines these sources of variation in its visual comparisons documentation.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • 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
  • Use the same browser and version for each baseline run.
  • Keep viewport dimensions, device-scale behavior, and emulation settings fixed.
  • Use the same environment and headless setting when comparing runs.
  • Wait for dynamic content and animations to reach the intended state.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common problems and fixes

The mobile capture still looks like desktop

Check that the viewport is configured before goto() rather than changed after the page has loaded. If the page depends on mobile-specific behavior beyond dimensions, use device emulation properties as well.

The screenshot is blank or missing content

Navigation may have finished before the application rendered the target content. Wait for a meaningful selector or application readiness condition, and check whether authentication or a failed request prevents the content from appearing.

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.

Captures differ even though the page did not change

Confirm that the browser version, operating system, viewport, device scale, emulation settings, and headless mode match. Also check for content that changes between runs, such as timestamps, rotating banners, or animation frames.

Files overwrite each other or are hard to identify

Include the page identifier and viewport width and height in every filename. Add a browser or device label when the same dimensions can be produced under different emulation settings.

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 would rather request captures from an API, ScreenshotNeo accepts a URL in one GET request and can return PNG, JPEG, WebP, or PDF. Its options include viewport sizes, device presets, full-page capture, and bulk capture for up to 100 URLs per call. The request below uses stripe.com; adapt the target URL and capture parameters to your needs. See the ScreenshotNeo documentation.

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

ScreenshotNeo accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses include X-Page-Verdict and X-Billed headers. Its MCP server provides screenshot tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots. Sign up free for 1,000 screenshots a month, with no card required.

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

Frequently Asked Questions

Can one browser context capture several viewport sizes?

Yes. Playwright allows pages to have distinct viewports, and contexts can also apply viewport configuration to their pages. Separate configurations can be clearer when device properties differ.

Does a larger screenshot image mean the page used a larger CSS viewport?

No. Device-pixel scaling can increase output image resolution without changing the CSS viewport dimensions.

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.

browser automationPlaywrightResponsive DesignscreenshotsWeb development

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.

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
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.