Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix 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 desk5 min

How to Set Screen Size and Device Scale Factor with Puppeteer

Use Puppeteer’s awaited page.setViewport() call to configure viewport width, height, and deviceScaleFactor before navigation. Learn how it differs from window and screen sizing.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use page.setViewport() to set a Puppeteer page’s viewport width, height, and device scale factor. Await the call and, in most cases, make it before navigating so the site sees those device metrics on its initial load. A viewport is not the same as the outer browser window or the available display; choose a different API if one of those is what you need to control.

Set a custom viewport and device scale factor

For a responsive-layout test or a screenshot at specific dimensions, configure the page directly. This ES module example uses a 390-by-844 viewport and a device scale factor of 3:

As an Amazon Associate I earn from qualifying purchases.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();

  await page.setViewport({
    width: 390,
    height: 844,
    deviceScaleFactor: 3,
  });

  await page.goto('https://example.com');
  // Continue with automation using the configured page.
} finally {
  await browser.close();
}

width and height set the page viewport dimensions; deviceScaleFactor sets the scale factor used for device metrics. The values above are an example configuration, not a claim that every phone uses those dimensions or that every site will render identically to a physical device. The setViewport() method returns a promise, so await it. Puppeteer cautions that some sites do not expect a phone-like size change, and changing certain mobile or touch settings can reload a page.

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

Why set it before navigation?

Set the viewport before page.goto() when the site may choose its layout or behavior from the initial device metrics. That way, the page begins loading with the requested viewport rather than changing after the site has already responded to an earlier size.

#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

Use a named device when dimensions alone are not enough

If you want Puppeteer to apply a known device’s viewport and user agent together, use page.emulate() with an entry from KnownDevices. The documented example uses iPhone 17 Pro:

import puppeteer, { KnownDevices } from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.emulate(KnownDevices['iPhone 17 Pro']);
  await page.goto('https://example.com');
  // Continue with automation.
} finally {
  await browser.close();
}

Emulate the device before navigation. Device names and presets can change between Puppeteer releases, so check that the requested entry exists in the version installed in your project. A named preset is useful when user-agent behavior matters; for a custom responsive viewport where only dimensions and scale factor matter, setViewport() is the direct choice.

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

Know which size you are changing

“Screen size” can refer to three different things in Puppeteer. Pick the control based on what the page or test needs to observe:

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.
What you want to control Relevant Puppeteer API or setting What it means
Page layout viewport page.setViewport({ width, height, deviceScaleFactor }) Sets the viewport metrics for that page. Each page can have its own viewport.
Browser window or content dimensions Page.resize, Browser.getWindowBounds, and Browser.setWindowBounds Use window management when you need to resize or inspect the content area or outer window bounds. The outer window can include browser chrome beyond the inner content size.
Available display or screen topology --screen-info, Browser.screens, Browser.addScreen, and Browser.removeScreen These concern the screens available to the browser, not just the page viewport. Puppeteer documents --screen-info as headless-only.

In headless Chrome, Puppeteer documents one 800×600 screen by default unless --window-size is specified. Headful Chrome uses the platform’s physical screens. Those defaults describe the available screen, not the dimensions set by a page’s setViewport().

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.

Understand viewport defaults and reset behavior

ConnectOptions.defaultViewport sets the viewport for each page and is documented with a default of { width: 800, height: 600 }. If a newly created page appears constrained even though you did not call setViewport() yourself, check the browser connection’s default viewport configuration.

To reset a page viewport to its configured default, call:

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
await page.setViewport(null);

The default is not necessarily an unconstrained or maximized browser window: it is the configured default viewport.

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.

Check the protocol before using emulation options

Puppeteer’s WebDriver BiDi documentation describes a narrower viewport surface than the broader API documentation: through BiDi, Page.setViewport supports only width, height, and deviceScaleFactor. The guide also lists Page.emulate() and other emulation capabilities as unsupported over BiDi. If your automation uses BiDi, verify the needed operation against that protocol’s current support rather than assuming every Puppeteer emulation feature is available.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot viewport and scale-factor problems

  • The page still looks like the default size: Confirm the call is on the page you are inspecting, that it is awaited, and that later setup code does not reset the viewport. Check whether defaultViewport is configuring newly created pages.
  • The initial layout is wrong, then changes: Move setViewport() before goto(). Sites can respond to the initial device metrics, so changing the size afterward may produce a different navigation or layout sequence.
  • The outer browser window did not change: setViewport() controls page viewport metrics, not necessarily the outer window bounds. Use Puppeteer’s window-management APIs if the content or browser window dimensions are the target.
  • A named-device call fails or behaves differently: Verify the device name against KnownDevices in your installed Puppeteer version, and confirm that your selected protocol supports the emulation operation.
  • A page reloads after a mobile or touch configuration change: Puppeteer notes that some mobile-related changes can reload pages. Apply the device configuration before navigation when possible.
  • The result does not match a physical display setup: A page viewport, browser window, and available screen are distinct. Identify which one the test depends on, then configure that layer instead of treating the three as interchangeable.

Or skip the browser setup

If your goal is a website screenshot rather than browser automation, ScreenshotNeo can return an image or PDF from one GET request. For example, this cURL call saves a WebP screenshot of Stripe; see the ScreenshotNeo API documentation for request options.

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 and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. It also provides an MCP server with screenshot and PDF tools for AI agents. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

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

Documentation and version notes

The Puppeteer documentation versions represented here are 25.12.0 for the core API and getting-started guide, 25.11.0 for the device-emulation page, and 25.10.0 for the Device interface page. Check your installed dependency’s documentation because APIs, presets, and protocol support can change between releases.

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 *

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.