Set the viewport before capturing: in Playwright, pass viewport: { width, height } when creating a browser context or in Playwright Test configuration. To resize a page that already exists, use page.setViewportSize(). Viewport dimensions control the visible CSS layout area; device scale factor, screenshot pixel scale, and full-page capture are separate settings.
Set the viewport in Playwright Test
Configure the Chromium project’s viewport in playwright.config.js or its TypeScript equivalent. When using a device preset, spread it first so the explicit viewport below overrides the preset’s viewport:
As an Amazon Associate I earn from qualifying purchases.
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1280, height: 720 },
},
},
],
});
Choose dimensions that match the layout or responsive breakpoint you need to test. The values above are examples, not universally correct screenshot dimensions. Playwright documents context viewport configuration and page resizing in its Emulation guide.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesSet the viewport when creating a browser context
For a standalone Playwright script, pass the viewport to browser.newContext() before creating the page. This complete example launches Chromium, navigates to a page, saves a screenshot, and closes the browser:
#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
import { chromium } from 'playwright';
const browser = await chromium.launch();
const context = await browser.newContext({
viewport: { width: 1280, height: 1024 },
});
const page = await context.newPage();
await page.goto('https://example.com');
await page.screenshot({ path: 'page.png' });
await context.close();
await browser.close();
The width and height are CSS pixels. They define the emulated visible area of the page and affect responsive layout.
Resize an existing page
If the page has already been created, change its viewport with page.setViewportSize() before taking the screenshot:
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
await page.setViewportSize({ width: 1600, height: 1200 });
await page.screenshot({ path: 'page.png' });
This resizes the visible browser area; it does not request that the screenshot include all content below the fold.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Keep viewport, pixel density, screenshot scale, and capture scope separate
“Resolution” can refer to several different settings. Set each one according to the result you need:
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.
| Setting | What it controls | How to set it |
|---|---|---|
| Viewport | The visible page dimensions in CSS pixels and the responsive layout scenario. | viewport: { width, height } in a context or project, or page.setViewportSize(). |
| Device scale factor | Emulated pixel density, which is independent of viewport width and height. | Set deviceScaleFactor in the browser context. |
| Screenshot scale | Whether output pixels follow CSS pixels or device pixels. Device-pixel output can be larger for a high-DPI context. | Use the screenshot scale option, 'css' or 'device'. |
| Capture scope | Whether the screenshot covers the visible viewport or the full scrollable page. | Set fullPage: true to capture the full page. |
For example, to emulate a high-density display, configure device scale factor separately:
const context = await browser.newContext({
viewport: { width: 1280, height: 720 },
deviceScaleFactor: 2,
});
Then choose screenshot scale for the desired bitmap output. Playwright’s API reference explains the scale and fullPage options in its API parameters documentation. Increasing viewport height and setting fullPage: true are not interchangeable: the former changes the visible area, while the latter captures beyond it.
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
Use Chromium’s DevTools Protocol for lower-level control
If you are controlling Chromium through the Chrome DevTools Protocol (CDP), Emulation.setDeviceMetricsOverride sets emulated device metrics, including dimensions and device scale factor. The Page domain includes screenshot capture functionality. CDP commands require a debugging session attached to the relevant target, and protocol details can change between Chromium builds. Check the schema for the Chromium version you run in the Chrome DevTools Protocol Page reference and the corresponding Emulation domain documentation. If your project already uses Playwright, its context and page APIs are usually the more direct option.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Or skip the browser setup
ScreenshotNeo can return a screenshot from one GET request. Set the viewport with its documented request parameters; see the ScreenshotNeo API documentation for the available options.
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://stripe.com -o shot.webp
ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture, with each cleanup step configurable. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed; response headers report the page verdict and billing status. Its MCP server gives AI agents screenshot, page-info, and PDF-capture tools. The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
Troubleshooting viewport screenshots
- The page uses the wrong responsive layout: Verify that the intended width and height are set on the context or project before navigation and capture. If a device preset is involved, spread it before the explicit
viewportso your values take precedence. - The image dimensions do not match the viewport numbers: Check
deviceScaleFactorand the screenshotscaleoption. Viewport dimensions are CSS pixels, and screenshot scale determines whether output is based on CSS or device pixels. - The screenshot cuts off content: A taller viewport only changes the visible area. Use
fullPage: truewhen you need the full scrollable page. - A responsive change is missing after resizing: Ensure
page.setViewportSize()completes before taking the screenshot, then allow the page’s layout and any responsive scripts to update. - CDP metrics have no effect: Confirm that the debugging session is attached to the target you are capturing and consult the protocol schema matching your Chromium build; CDP details evolve.
Frequently Asked Questions
What viewport size should I use for a Chromium screenshot?
There is no single universally correct size. Choose the width and height for the device or responsive layout scenario you want to represent.
Recommended Free Tools
Can I set a viewport in plain Chromium without Playwright?
Yes. Chromium automation through CDP can set device metrics with Emulation.setDeviceMetricsOverride; it requires an attached debugging session.
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.




