To change a page’s responsive viewport in Puppeteer, use await page.setViewport({ width, height }), preferably before navigating. To resize the browser window so the page’s content area has specific dimensions, clear the default viewport with await page.setViewport(null) and use page.resize({ contentWidth, contentHeight }). That window-resize method is experimental, so check support in your installed Puppeteer version.
Choose what you need to resize
“Page size” can mean the viewport the site uses for responsive layout, or the browser window’s content area. These are separate controls: setViewport() configures page viewport dimensions; resize() targets the browser window’s content dimensions. The latter is documented as experimental. Puppeteer’s v25.12.0 API documentation covers the viewport method, and its window-management guide shows content sizing.
As an Amazon Associate I earn from qualifying purchases.
Set a responsive viewport
Set the viewport before navigation when possible. Puppeteer notes that some websites do not expect phone-size changes; changing isMobile or hasTouch can also reload the page. The official API example follows this order.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.setViewport({
width: 640,
height: 480,
deviceScaleFactor: 1,
});
await page.goto('https://example.com');
console.log(await page.evaluate(() => ({
width: window.innerWidth,
height: window.innerHeight,
})));
} finally {
await browser.close();
}
setViewport() accepts a viewport object or null and returns a promise, so await it. The example uses a 640-by-480 CSS-pixel viewport and a scale factor of 1; change these values to match the layout you want to test.
#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
Use a device preset when needed
If you need a particular device’s user agent as well as its viewport, use page.emulate(device). Puppeteer describes this as a shortcut for setting both. Emulate before navigation when possible, especially if the site may behave differently when it detects a phone. The cited API result identifies Puppeteer v25.11.0. See the emulate API reference.
Resize the browser window’s content area
Use this approach when the browser window itself must have a chosen content width and height, rather than merely emulating a viewport. The documented sequence removes the default viewport constraint, requests the resize, waits for the browser’s resize event, and then reads the resulting dimensions.
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
import puppeteer from 'puppeteer-core';
const browser = await puppeteer.launch({
args: ['--screen-info={800x600}'],
});
try {
const page = (await browser.pages())[0];
// Let the browser window determine the content area size.
await page.setViewport(null);
// Register the listener before requesting the asynchronous resize.
const resized = page.evaluate(() => new Promise(resolve => {
window.addEventListener('resize', resolve, { once: true });
}));
await page.resize({ contentWidth: 600, contentHeight: 400 });
await resized;
const dimensions = await page.evaluate(() => ({
innerWidth: window.innerWidth,
innerHeight: window.innerHeight,
outerWidth: window.outerWidth,
outerHeight: window.outerHeight,
}));
console.log(dimensions);
} finally {
await browser.close();
}
The API marks Page.resize experimental, so verify that your installed version and runtime support it before relying on it. Check its API reference. In the official guide’s example environment, the reported inner dimensions are 600×400 and outer dimensions 600×487; the outer size depends on the environment and is not a universal browser-chrome allowance. See the guide.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Measure the result, not just the setting
page.viewport() returns the last configured viewport or the connection’s defaultViewport; it does not verify the page’s live dimensions. For a window resize, wait for the resize event and inspect browser values such as window.innerWidth and window.innerHeight. The viewport API reference explains what the method reports.
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.
Unless configured otherwise, ConnectOptions.defaultViewport applies to each page and defaults to 800×600. Setting the viewport to null removes that default viewport constraint in the window-management example. See the ConnectOptions reference.
Keep screen size and screenshot scope separate
Headless Chrome’s screen defaults to 800×600 unless configured with --window-size; --screen-info is headless-only. Headful Chrome uses the platform’s physical screens. Screen geometry is separate from a page’s viewport. Puppeteer’s window-management guide documents these distinctions.
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
If the goal is a full-page screenshot, request fullPage: true instead of enlarging the viewport just to capture beyond the visible area. Clipping and capture beyond the viewport are separate screenshot controls. See the screenshot options reference.
Troubleshooting
- The layout did not change: confirm you called and awaited
page.setViewport()on the page you navigate, and that the width and height are the intended viewport dimensions. - The page reloaded after resizing: this can happen when changing
isMobileorhasTouch. Configure those values before navigation where practical. Puppeteer documents this behavior. page.resizeis missing or fails: it is experimental and may not be supported by the installed version or runtime. Check the API reference for the version in use; usesetViewport()instead if you only need responsive rendering.- The measured dimensions seem stale: do not treat
page.viewport()as a live measurement. For window sizing, attach a one-timeresizelistener before callingpage.resize(), then evaluatewindow.innerWidthandwindow.innerHeight. - The outer window dimensions differ from the requested content size:
contentWidthandcontentHeighttarget the content area, not the entire outer window. Browser chrome and runtime environment affect outer measurements. - A full-page screenshot is still cut off: use the screenshot’s
fullPageoption or the relevant clipping controls; viewport resizing alone is not the full-page capture setting.
Or skip the browser setup
For an image or PDF without managing a Puppeteer browser session, ScreenshotNeo accepts a URL in one API request. Cookie banners are accepted and removed before capture, and known consent platforms, newsletter popups, and chat widgets can be removed; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with verdict and billing details in response headers. An MCP server lets AI agents use screenshot and PDF tools. The free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000 shots.
Install the request dependency with python -m pip install requests, then replace the URL and API key:
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.
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
For the available parameters and response behavior, see the ScreenshotNeo API documentation. Sign up for the free plan: 1,000 screenshots a month, no card required.
Frequently Asked Questions
Which Puppeteer version is this guidance based on?
The cited setViewport, window-management, resize, and emulate references identify v25.12.0, except the emulate API result, which identifies v25.11.0. Check the documentation matching your installed version, particularly for experimental methods.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsQuick 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.




