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

Set the viewport or emulate a mobile device before navigating, then save a screenshot at each configuration with a distinct filename. Use fullPage: true when you need the entire document rather than only the visible viewport. The example below captures both layouts in one Puppeteer run.

Capture desktop and mobile screenshots with Puppeteer

This Node.js example uses ESM imports and Puppeteer’s documented device descriptors. The desktop dimensions and selected device are examples, not universal breakpoint recommendations; choose settings that match the layouts you need to inspect.

import puppeteer, {KnownDevices} from 'puppeteer';

const url = 'https://example.com';
const browser = await puppeteer.launch();

try {
  const desktop = await browser.newPage();
  await desktop.setViewport({width: 1440, height: 900});
  await desktop.goto(url, {waitUntil: 'networkidle2'});
  await desktop.screenshot({path: 'example-desktop.png'});

  const mobile = await browser.newPage();
  await mobile.emulate(KnownDevices['iPhone 17 Pro']);
  await mobile.goto(url, {waitUntil: 'networkidle2'});
  await mobile.screenshot({path: 'example-mobile.png'});
} finally {
  await browser.close();
}

Install Puppeteer in your Node.js project before running the script. Save it as an .mjs file, or use a project configured for ES modules. Replace https://example.com with the page you want to capture. The Puppeteer screenshots guide documents the navigation-and-screenshot workflow, and Page.emulate() documents the device-emulation approach.

Choose viewport dimensions or a device descriptor

Set explicit desktop dimensions

page.setViewport({width, height}) sets the page’s viewport dimensions in CSS pixels. It is suitable when you want to inspect a site at a specific width and height without selecting a device profile. Select widths based on the site’s CSS and the layouts you need to check; there is no universally correct desktop or mobile breakpoint in the Puppeteer API documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

Emulate a mobile device

page.emulate(KnownDevices['iPhone 17 Pro']) applies device metrics and a user agent as well as resizing the page. Use a named descriptor when those emulated device settings matter, not just the viewport dimensions. This is browser emulation, not a test on a physical phone.

Configure the viewport or emulation before page.goto(). Puppeteer recommends that order for device emulation, since sites may not expect phone metrics to change after loading. Viewport changes can also trigger a reload in some cases, particularly when changing isMobile or hasTouch. See Page.setViewport() for the viewport API details.

Rank #2
Tracfone Motorola Moto G 2025, 64GB, Saphire Blue (Locked to
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Tracfone plan required, activating is easy, just 3 steps.
  • DISPLAY: Immersive viewing on a 6.7-inch super-bright 120Hz display with powerful stereo speakers and Bass Boost for cinematic entertainment.
  • CAMERA SYSTEM: Advanced 50MP Quad Pixel camera captures sharp, detailed photos and videos in any lighting condition
  • PERFORMANCE: Lightning-fast 5G connectivity paired with a powerful processor and RAM Boost for smooth multitasking.
  • BATTERY LIFE: Long-lasting 5000mAh battery with TurboPower charging technology delivers hours of power in minutes.

Choose what the screenshot includes

  • Visible viewport: page.screenshot({path: 'capture.png'}) captures the page view; fullPage defaults to false.
  • Entire page: set fullPage: true to capture beyond the visible viewport.
  • Specific region: use the clip option to capture a defined area.
  • One element: use ElementHandle.screenshot(). Puppeteer tries to scroll a hidden element into view by default.

The ScreenshotOptions API also documents output path, type, quality (not applicable to PNG), and omitBackground.

Wait for the page state you need

The example uses waitUntil: 'networkidle2', as in Puppeteer’s screenshot guide. Treat that as a navigation wait choice, not proof that every page is ready to capture. Dynamic content, lazy-loaded images, animations, and third-party widgets may need a site-specific readiness condition before the screenshot call. There is no single readiness condition established for every site by the API guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

If the capture is missing content, identify what signals readiness on that site, then wait for that condition before calling screenshot(). For example, a page-specific selector can be more meaningful than assuming network activity alone indicates that all visible content has settled.

Troubleshoot common capture problems

  • The mobile screenshot looks like desktop: confirm emulate() runs before navigation and that the chosen descriptor is appropriate. A plain viewport sets dimensions but does not apply the device metrics and user agent of a device descriptor.
  • The layout changes unexpectedly or reloads: set the intended viewport properties before navigation, especially if changing isMobile or hasTouch.
  • The screenshot cuts off below the fold: add fullPage: true. The default is a viewport capture.
  • Content is absent from the image: wait for the page-specific content to be ready before capturing. networkidle2 is an example wait condition, not a guarantee for dynamic pages.
  • Two captures overwrite each other: use distinct paths, such as example-desktop.png and example-mobile.png.

Or skip the browser setup

For a one-request capture, ScreenshotNeo accepts a URL and returns a screenshot or PDF. See the ScreenshotNeo API documentation for request options.

Rank #4
Sale
Samsung Galaxy S26 Ultra, Unlocked Android Smartphone, 512GB, Black
  • PRIVACY DISPLAY: Automatically hide your screen from those beside you. The built-in privacy display can be preset¹ to turn on when receiving notifications, typing passwords, or using specific apps
  • TYPE IT IN. TRANSFORM IT FAST: Enhance any shot in seconds on your smartphone by using Photo Assist² with Galaxy AI.³ Add objects, restore details, or apply new styles by simply typing or tapping
  • NIGHTS, CAPTURED CLEARLY: From gigs to city lights, record and capture moments after dark with clarity using Nightography so your photos and videos stay crisp and clear on your Samsung Galaxy
  • MAKE IT. EDIT IT. SHARE IT: Turn everyday moments into something personal with creative tools built right into your mobile phone, whether it’s a special contact photo, custom wallpaper, an invitation or more⁴
  • HELP THAT KEEPS UP: Stay in the moment while Now Nudge with Galaxy AI helps you respond faster and stay organized with smart suggestions⁵ that appear exactly when you need them on your phone
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. An MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Visit ScreenshotNeo to learn more, or sign up free.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

What does Puppeteer use to take a screenshot?

Use Page.screenshot() for a page capture; use ElementHandle.screenshot() when you need one element.

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

Does Puppeteer mobile emulation test a real phone?

No. It emulates device settings in the browser; it is not a physical-device test.

Quick Recap

Best Value
Tracfone Moto g Play 2024 Prepaid Phone with a 1-Yr Plan Included
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Activating is easy, just 3 steps.
  • ACTIVATION Promotion: Includes 1500 min, 1500 texts & 1500 MB Data + add more as you need it
  • CAMERA SYSTEM: 50MP Quad Pixel camera. Capture sharper, more vibrant photos day or night with 4x the light sensitivity.
  • PERFORMANCE: Blazing-fast Qualcomm performance. Get the speed you need for great entertainment with a Snapdragon 680 processor and 4GB of RAM.
  • 64GB built-in storage. Get plenty of room for photos, movies, songs, and apps. Made for US

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.