Free tools Windows power users keep installed
One-click scans. No signup required.
To capture a webpage at 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 browser window as a PNG. Setting a window’s dimensions alone is useful for responsive-layout checks, but it does not configure mobile device metrics such as pixel ratio.
Configure Chrome mobile emulation before starting Selenium
Set the emulated device metrics in Chrome options before creating the driver. The dimensions below are illustrative CSS viewport values, not a universal phone profile. Choose width, height, and pixel ratio to match your test case.
As an Amazon Associate I earn from qualifying purchases.
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 load event, but that may not mean an app’s later-rendered content or images are ready. Replace the wait with a condition for the specific element or state your test needs. Selenium’s Chromium Options reference describes mobile emulation as configuring the browser to emulate a mobile device: Selenium JavaScript Options API.
Choose between a narrow window and mobile emulation
Use set_window_size(width, height) when you need to inspect a page in a browser window of particular dimensions, such as a desktop responsive-layout check. Use Chrome mobile emulation when the test requires mobile device metrics. Resizing the window does not, by itself, configure those metrics.
#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
For mobile emulation, configure explicit metrics when you need exact CSS viewport dimensions and pixel ratio. A named device preset is another option, but its availability can depend on the installed Chrome and ChromeDriver versions. Explicit values can be more predictable when your test requires particular dimensions.
Save the viewport screenshot
driver.save_screenshot("mobile-viewport.png") saves the current window as a PNG. Selenium’s Python API returns a boolean, so check it and handle a failed save rather than assuming the file was written. Use an element screenshot API only when you want a particular element, not the full current viewport.
Always close the driver in a finally block. This ensures the browser process is cleaned up if navigation, waiting, or saving raises an error.
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
Verify the result against your test target
- Check that the page uses the intended mobile layout and that the content you needed is visible.
- Inspect the saved image dimensions. The configured width and height are device viewport metrics; output raster dimensions can also reflect pixel ratio and browser or driver behavior.
- If the image dimensions differ from expectations, verify your CSS viewport values, pixel ratio, and Chrome/ChromeDriver versions. The configuration references do not guarantee identical raster dimensions across every environment.
- Treat the image as evidence of the configured emulation, not proof of how every physical phone or mobile browser will render the page. Validate separately on an actual device when that fidelity matters.
JavaScript Selenium configuration
In Selenium’s JavaScript API, configure Chrome mobile emulation with setMobileEmulation before creating the driver:
const chrome = require('selenium-webdriver/chrome');
const options = new chrome.Options().setMobileEmulation({
deviceMetrics: { width: 360, height: 640, pixelRatio: 3.0 }
});
You can also provide a supported device preset with setMobileEmulation({deviceName: '...'}). Check the preset against your installed browser and driver versions. See the Selenium JavaScript Options API.
Troubleshooting
The screenshot has desktop styling
Check that mobile emulation is configured on Chrome options before the driver session starts. Setting only the window size does not apply the mobile device metrics used by emulation.
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.
The page is missing content
A completed navigation does not guarantee that scripts, lazy-loaded images, or asynchronous components have finished rendering. Wait for a page-specific element or condition instead of relying only on document.readyState.
The image dimensions do not match the viewport numbers
Confirm whether you are comparing CSS viewport dimensions with raster image pixels, and account for the configured pixel ratio. Browser and driver versions may also affect output; the API references do not promise identical image dimensions in every environment.
A named device preset is unavailable
Preset availability can vary with Chrome and ChromeDriver versions. Use explicit device metrics when the exact viewport dimensions are more important than a named preset.
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
The screenshot file was not saved
Check the boolean returned by save_screenshot, confirm the process can write to the target path, and handle a false result as a failure. Keep driver shutdown in finally so a save error does not leave the browser running.
Or skip the browser setup
ScreenshotNeo offers a website screenshot API and MCP server for developers. One GET request can return a PNG, JPEG, WebP, or PDF. Its clean-shot steps accept cookie and consent banners like a visitor and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status. An 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.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →For example, this cURL request saves a WebP screenshot of the target URL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo API documentation for request options, or visit ScreenshotNeo for product details. Sign up for 1,000 free screenshots a month, with no card required.
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.
Frequently Asked Questions
Does Selenium’s Python screenshot method save a PNG?
Yes. `driver.save_screenshot()` saves the current window image as a PNG and returns a boolean indicating whether the save succeeded.
Does an emulated mobile screenshot prove what a physical phone will show?
No. It records the configured emulation; it is not proof of rendering on every physical device or mobile browser.
Recommended Free Tools
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.




