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

To capture a webpage at a mobile viewport size with Selenium and Chrome, configure Chrome’s mobile emulation before creating the WebDriver session, load the page, wait for the content you need, then save the current-window screenshot. Resizing a browser window is useful for responsive-layout checks, but it is not the same as enabling mobile emulation.

Set up Chrome mobile emulation and capture the viewport

Use explicit device metrics when you need a particular viewport. The dimensions below are illustrative CSS-pixel values, not a universal phone profile. Choose dimensions and pixel ratio that match your test case. See Selenium’s Chrome options documentation for mobile-emulation configuration and the Python WebDriver API reference for screenshot behavior.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait

options = Options()
options.add_experimental_option("mobileEmulation", {
    "deviceMetrics": {
        "width": 390,
        "height": 844,
        "pixelRatio": 3.0,
    }
})

driver = webdriver.Chrome(options=options)
try:
    driver.get("https://example.com")
    # Replace this with a condition for the page's real ready state/content.
    WebDriverWait(driver, 10).until(
        lambda d: d.execute_script("return document.readyState") == "complete"
    )
    ok = driver.save_screenshot("mobile-viewport.png")
    if not ok:
        raise RuntimeError("Screenshot file could not be saved")
finally:
    driver.quit()

The example waits for the document’s load state. If the page fills in content asynchronously, wait for a relevant element or condition instead; navigation completing does not guarantee that every later asset has rendered. save_screenshot captures the current window as a PNG and returns a boolean indicating whether saving succeeded.

Choose the right kind of mobile-size test

Window resizing for responsive layout

Selenium’s set_window_size(width, height) changes the browser window dimensions. Use it when you want to inspect a page in a narrower desktop browser window. It does not, by itself, configure all the device metrics used by Chrome’s mobile emulation. Selenium documents window management and screenshots in its Working with windows and tabs guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • 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

Mobile emulation for mobile rendering metrics

Configure Chrome mobile emulation before creating the driver when the page must respond to emulated mobile device metrics such as width, height, and pixel ratio. ChromeDriver describes this configuration as emulating a mobile device in its mobile emulation guide. An emulated capture represents that browser configuration; it is not proof that the page behaves identically on every physical phone or mobile browser.

Use a named device preset or custom metrics

A supported named preset can be convenient when the test should follow a device profile. Selenium’s JavaScript API demonstrates a Pixel 10 preset; available names can depend on the installed Chrome and ChromeDriver versions. When exact dimensions matter, custom metrics make the requested width, height, and pixel ratio explicit.

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
const chrome = require('selenium-webdriver/chrome');
const options = new chrome.Options().setMobileEmulation({
  deviceMetrics: { width: 360, height: 640, pixelRatio: 3.0 }
});

The same Selenium JavaScript Options API documents the setMobileEmulation({deviceName: ...}) form for presets. Confirm that the preset is supported by the Chrome/ChromeDriver version used for the session.

Capture the current window or a specific element

For a mobile viewport screenshot, use the current-window method shown above. Selenium also provides element screenshot operations when the requirement is to capture one selected element rather than the viewport. These outputs answer different questions: a viewport capture shows the visible browser area, while an element capture focuses on the chosen page element.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Check the output and diagnose common problems

  • The page still looks like desktop. Confirm that mobile emulation is configured on the Chrome options before webdriver.Chrome() creates the session. A window resize alone is not equivalent.
  • The screenshot misses late-loading content. Replace the generic document-ready wait with a wait for the actual content, selector, or application state required by the test.
  • The saved file has unexpected dimensions. Check whether your expected dimensions refer to CSS viewport metrics or raster image pixels. Account for the configured pixel ratio and the browser/driver environment; the configuration references do not promise identical raster dimensions across every environment.
  • The screenshot was not saved. Check the return value from save_screenshot; it reports success or failure. Also confirm that the process can write to the destination path.
  • A named device is not recognized. Preset availability can depend on Chrome and ChromeDriver versions. Use explicit custom metrics when you need fixed dimensions.
  • The capture differs from a real phone. Treat emulation as evidence for the configured test setup, not a substitute for validating behavior on the physical devices and browsers your users rely on.

Or skip the browser setup

ScreenshotNeo captures a page through one API request, without setting up a Selenium browser session. Cookie banners are accepted and removed before the shot, along with supported newsletter popups and chat widgets. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents use screenshot tools, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

For API options and response details, see the ScreenshotNeo documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo is a website screenshot API and MCP server from ScreenshotNeo. Sign up for 1,000 free screenshots a month with no card.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

Does Selenium’s current-window screenshot save a PNG?

Yes. Python’s driver.save_screenshot("file.png") saves the current-window image as a PNG and returns a boolean result.

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.

Does a mobile-emulation screenshot prove how a page works on every phone?

No. It documents a capture under the configured emulation; validate separately on real devices and browsers when that coverage matters.

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.

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.