Set the browser’s viewport width and height in CSS pixels before navigating to the page, then take a regular viewport screenshot. In Playwright, this produces an image of the visible page area at your chosen responsive layout size—not the full page or browser window.
Viewport size, screenshot size, and page size are different
A viewport is the browser page area used to lay out and render a webpage. Playwright takes its width and height in CSS pixels. A screenshot of that viewport captures the currently visible page area; it does not include browser controls or the operating-system screen.
As an Amazon Associate I earn from qualifying purchases.
- Viewport screenshot: the visible browser page area at the configured viewport dimensions.
- Full-page screenshot: the whole scrollable page, so the saved image can be taller than the viewport.
- Clipped screenshot: a specified rectangular region of the page, described by its x and y position, width, and height.
- Device scale: output pixel density. It can change the saved image’s raw pixel dimensions without changing the CSS layout viewport.
Decide whether your requirement specifies the browser’s CSS viewport or the image’s raw pixel dimensions before capturing. Playwright’s Page API documents viewport sizing and screenshot behavior; its screenshot guide explains viewport, element, and full-page captures.
Recommended Free Tools
Capture a viewport screenshot with Playwright
Set the viewport before navigation when you need the page’s responsive layout to reflect those dimensions. Playwright’s documentation cautions that many websites do not expect phones to change size and recommends setting the viewport before navigating.
#1 Best Overall
- 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
JavaScript example
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.setViewportSize({ width: 1280, height: 800 });
await page.goto('https://example.com');
await page.screenshot({ path: 'screenshot.png' });
await browser.close();
})();
Replace 1280 and 800 with the width and height you need. These are illustrative values, not a recommended standard. The default screenshot is viewport-only; use fullPage: true only when you want the entire scrollable page.
Set a screen size separately when needed
page.setViewportSize() also resets the screen size. If your test needs more precise control over both screen and viewport, configure them on the browser context instead. This matters when reproducing a particular device environment; changing the viewport alone is not the same as emulating every aspect of a device.
Rank #2
- 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, full-page, or clipped capture
Capture only what is visible
For a screenshot at the requested viewport size, leave fullPage unset or set it to false. The image represents the visible page area, even if the document continues below the fold.
Capture the entire scrollable page
Set fullPage: true in the screenshot options to capture beyond the viewport. The resulting image is not limited to the viewport’s height, so it is the wrong choice when the deliverable must have the viewport’s dimensions.
Rank #3
- 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.
Capture a rectangular region
If you need a particular part of a page rather than a different responsive layout, use screenshot clipping. A clip rectangle defines x, y, width, and height; it does not resize the page viewport. See Playwright’s screenshot options and the Chrome DevTools Protocol Page domain for the documented capture options.
Set the output pixel scale
CSS-pixel scaling produces one output pixel per CSS pixel. Device scaling follows the device pixel ratio and can produce an image with more raw pixels than the CSS viewport dimensions. Choose based on what the image is for: layout checks often need the specified CSS size, while a higher-density asset may call for device scaling. Device scale changes pixel density, not the responsive layout viewport.
Rank #4
- 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
Wait for the page state you need
After navigation, capture only when the page has reached the state relevant to your task. There is no single wait condition or delay that suits every website: a static page, a client-rendered app, and a page with late-loading content can become screenshot-ready at different times. Choose a readiness condition for the target page rather than relying on an arbitrary universal delay. If you need a particular element to appear, wait for that element before taking the screenshot.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Troubleshoot common viewport screenshot problems
- The layout looks like desktop when you expected mobile: set the viewport before calling
goto(), and check that you used the intended width and height in CSS pixels. - The image is much taller than requested: check whether
fullPage: trueis enabled. Turn it off for a viewport-only capture. - The saved image has more pixels than the viewport: inspect the device scale setting. Device-pixel output can be denser while retaining the same CSS viewport.
- The screenshot shows a blank or incomplete page: navigation finishing does not necessarily mean all page-specific content is ready. Wait for a relevant selector or other condition suited to the site.
- You changed the viewport but needed only a crop: keep the viewport as-is and define a clip rectangle for the desired region.
- The page still does not match a particular device: viewport dimensions control layout width and height, but they do not by themselves configure every screen or device characteristic. Configure the screen and viewport through the browser context when that distinction matters.
Or skip the browser setup
ScreenshotNeo is a screenshot API and MCP server for developers. A GET request supplies the target URL and returns a PNG, JPEG, WebP, or PDF; viewport and other capture options are documented in the ScreenshotNeo API docs. For example, this call captures a page using the API’s default settings:
Best Value
- 【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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
Use ScreenshotNeo when you want to avoid maintaining browser setup: it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo’s free plan.
Cost and repeat-capture considerations
For a one-off capture or a workflow that needs direct browser control, Playwright lets you choose the viewport and page state in code. For repeat captures, weigh the effort of maintaining the browser environment against a hosted API’s request model. If you require exact raw image dimensions, verify output scale as well as viewport dimensions; if you need repeatable responsive behavior, set dimensions before navigation and use a suitable readiness condition.
Frequently Asked Questions
Does setting a viewport guarantee the screenshot’s raw pixel dimensions match it?
No. Viewport dimensions are in CSS pixels; device scaling can produce a denser image with more raw pixels.
Can I capture a page section without changing its responsive layout?
Yes. Use a clip rectangle for the region rather than resizing the viewport.
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.




