Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

How to Take Retina-Resolution Screenshots with Selenium and Chrome

Use Chrome DevTools Protocol to set a Retina-like device scale factor independently of the Selenium viewport, then capture and validate the PNG.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To make a Selenium screenshot Retina-like, set Chrome’s device scale factor separately from the CSS viewport, then capture the page. For a desktop-style 2× capture, use Chrome DevTools Protocol’s Emulation.setDeviceMetricsOverride with deviceScaleFactor: 2 and mobile: false; save with Selenium’s screenshot method and check the resulting image dimensions. Changing the browser window size alone does not set pixel density.

Set the viewport and pixel density separately

A viewport width and height describe the page’s logical layout in CSS pixels. The device scale factor describes the relationship between those CSS pixels and device pixels. Chrome’s device-metrics override accepts dimensions and a deviceScaleFactor, and can affect screen dimensions visible to the page and device-width media queries. See the Chrome DevTools Protocol reference.

As an Amazon Associate I earn from qualifying purchases.

For a desktop-like 2× capture, a 1440 × 900 CSS-pixel viewport with a scale factor of 2 is a useful starting configuration. Do not assume the PNG will have a particular size without checking it in your own Chrome, ChromeDriver, Selenium, and operating-system setup.

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

Capture a Retina-like screenshot with Selenium Python

This example sets Chrome’s device metrics before capturing the current browsing context. Selenium documents save_screenshot as saving the current window screenshot to a PNG. It is not a guarantee of a full-page capture.

#1 Best Overall
Sale
Dell 27 Monitor S2725QS, 4K UHD IPS, 120Hz, 5ms, FreeSync Premium | 350 cd/m2 Brightness, 1,500:1 Contrast, 99% sRGB, Anti-Glare, HDMI, DisplayPort, USB‑C, Height Adjustable, Swivel, Pivot
  • Improved ComfortView Plus: Reduces harmful blue light emissions to ≤35%, for all-day comfort without sacrificing color accuracy.
  • Refresh rate: A smooth, tear-free experience with AMD FreeSync Premium (refresh rate up to 120Hz) and an ultra-low 0.03ms response time create a captivating experience for work and play.
  • Vivid colors: Immerse yourself in breathtaking 4K visuals with in-plane switching technology. Enjoy vibrant colors with 99% sRGB. The 1500:1 contrast ratio and HDR readiness deliver excellent depth and detail.
  • Re-engineered sound quality: Enjoy more detailed sound with spacious audio featuring greater output power, deeper frequency response and more decibel range than the previous generation.
  • Ultra-thin bezel: Designed with a sleek, modern aesthetic and an ash white finish, this display features ultra-thin bezels for a refined, minimalist design.
from selenium import webdriver

options = webdriver.ChromeOptions()
# Optional for a headless run:
# options.add_argument("--headless=new")

driver = webdriver.Chrome(options=options)

try:
    driver.get("https://example.com")
    driver.execute_cdp_cmd(
        "Emulation.setDeviceMetricsOverride",
        {
            "width": 1440,          # CSS viewport width
            "height": 900,          # CSS viewport height
            "deviceScaleFactor": 2, # Retina-like density
            "mobile": False,
        },
    )
    driver.save_screenshot("retina.png")
finally:
    driver.quit()

Selenium’s Chromium WebDriver API documents its Chrome DevTools Protocol command support, while the Chrome documentation covers Chrome setup and compatibility: Python Chromium WebDriver API and Selenium with Chrome. Confirm the command signature for the Selenium version pinned in your project; the protocol and language bindings can evolve.

Choose the right capture mode

Desktop-style density

Use mobile: false when you want a desktop-like page at a higher pixel density. Set width and height to the CSS viewport that should determine layout, and set deviceScaleFactor to the density you want to test. Keep window sizing and device metrics conceptually distinct: Selenium’s set_window_size(width, height) sizes the browser window, but does not by itself configure Chrome’s device scale factor. Selenium describes window management at Working with windows and tabs.

Rank #2
Sale
LG 27US500-W Ultrafine Monitor 27-Inch 4K UHD (3840x2160) HDR10 IPS Borderless Design Reader Mode Flicker Safe Switch App HDMI DisplayPort - White
  • 4K UHD with 1000:1 Contrast Ratio - This UltraFine display with a 1000:1 contrast ratio displays deeper blacks and vivid colors in UHD clarity. With wide viewing angles, it gives creative professionals the ability to view and work with highly-detailed, digital imagery.
  • 4K HDR10 DCI-P3 - Explore HDR10 content the way it was meant to be seen with up to 90% DCI-P3 color gamut expression—an elevated color spectrum that brings brilliant color to life.
  • Onscreen Control - You can customize the workspace by splitting the display or adjusting basic monitor options with just a few mouse clicks.
  • Ergonomic Stand - The ergonomic stand makes it easy to flexibly adjust the tilt of the screen in the optimal position for you.
  • What's In The Box - Stand Body, Stand Base, Screws, Power Adapter, HDMI Cable, Quick Start Guide, Registration Card, Warranty.

Mobile device emulation

If the goal is to reproduce an emulated mobile device, use a mobile-emulation configuration rather than treating a larger scale factor as equivalent to mobile. Mobile emulation changes more than pixel density. Selenium’s JavaScript Chrome options API describes mobile emulation settings including width, height, and pixel ratio: Chromium Options API.

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

Viewport screenshot versus beyond-viewport capture

driver.save_screenshot() captures the current browsing context; do not rely on it to include content below the visible viewport. Chrome’s Page.captureScreenshot protocol command has a captureBeyondViewport parameter, documented with a default of false. Use the Chrome protocol when the target needs beyond-viewport capture, and verify behavior for the Chrome version and page layout you run: Page protocol.

Rank #3
Sale
LG 32UR550K-B 32-inch Ultrafine 4K UHD (3840 x 2160) Computer Monitor, HDR10, 60Hz, HDMI, DisplayPort, Tilt/Height/Pivot Adjustable Stand, Black
  • Master Every Pixel - Bring every detail to life with LG’s UltraFine 32” 4K UHD HDR display. Whether you’re editing, streaming, or multitasking, the expansive screen and rich color deliver clarity you can count on.
  • Color Your World in 4K and HDR Content - Stream in stunning detail with the LG UltraFine 4K display. HDR technology delivers vibrant brightness and rich contrast, supporting up to 90% of the DCI-P3 color space for vivid, lifelike visuals that elevate every scene.
  • Immersive Visuals for Tactical Edge - Game in crisp 4K UHD with rich visuals and immersive audio powered by Waves MaxxAudio. With gaming features such as Dynamic Action Sync and Black Stabilizer, you’ll react faster and spot enemies in the shadows—so you’re always one step ahead.
  • Dynamic Action Sync - Don’t miss a beat. Dynamic Action Sync helps you spot the action and strike fast by reducing input lag and boosting responsiveness.
  • Never in the Dark with Black Stabilzer - Never get caught off guard. Black Stabilizer enhances visibility in low-light scenes so you can spot threats before they see you.

Validate the result before relying on it

  1. After capture, inspect the saved PNG’s pixel width and height with an image viewer or image-inspection tool.
  2. In the page, check window.innerWidth, window.innerHeight, and window.devicePixelRatio with Selenium’s JavaScript execution.
  3. Compare the CSS viewport values with the saved file’s pixel dimensions. If they do not match the expected relationship, check the actual Chrome version, headless mode, driver, device metrics, and page behavior.
  4. Wait for content that matters to settle before capturing, including fonts, images, and animations. Choose a wait condition suitable for the page; no single wait strategy is established for every site.

Common problems and fixes

  • The screenshot is not larger than expected: set_window_size controls browser window dimensions, not device scale factor. Apply the CDP device-metrics override before taking the screenshot, then inspect the PNG dimensions.
  • The page layout changes unexpectedly: Check the CSS viewport dimensions and whether mobile emulation is enabled. Use mobile: false for desktop-like rendering unless mobile behavior is the point of the capture.
  • The screenshot misses content below the fold: Selenium’s basic screenshot call is for the current browsing context. Use Chrome’s page screenshot protocol and its beyond-viewport option when appropriate, then check the result against your target version.
  • The CDP call fails or behaves differently: Check the Selenium version’s execute_cdp_cmd support and command signature, as well as the Chrome DevTools Protocol command parameters for the Chrome version in use.
  • Chrome fails to start or WebDriver cannot control it: Check that the Chrome and ChromeDriver major versions match. Selenium’s Chrome documentation states this compatibility requirement; version guidance can change, so confirm it for your installed setup.
  • Images or fonts are missing or still changing: Delay capture until the resources and page states relevant to your screenshot have settled. A navigation completing does not necessarily mean every visual element is ready.

Performance and repeatability considerations

A higher device scale factor generally means more output pixels for a given CSS viewport, so the image can require more storage and processing. Exact dimensions and resource costs depend on the environment and page; measure them in the setup that will run the job. Keep Chrome, ChromeDriver, Selenium, headless mode, viewport, and page state consistent where reproducibility matters. Selenium’s Chrome documentation notes that Chrome and ChromeDriver major versions should match: Selenium with Chrome.

Or skip the browser setup

ScreenshotNeo takes a screenshot or PDF with one GET request, without setting up Selenium and Chrome locally. The call below saves a WebP capture of the requested page; see the ScreenshotNeo API documentation for options.

Rank #4
Sale
Dell 32 Monitor S3225QS, 4K UHD VA, 120Hz, FreeSync Premium, Eye Comfort | 3840x2160, 31.5in, 3000:1 Contrast, 300 cd/m2 Brightness, 4ms, 99% sRGB, Anti-Glare, HDMI, DisplayPort
  • Improved ComfortView Plus: Reduces harmful blue light emissions to ≤35%, for all-day comfort without sacrificing color accuracy.
  • Refresh rate: A smooth, tear-free experience with AMD FreeSync Premium (refresh rate up to 120Hz) and an ultra-low 0.03ms response time create a captivating experience for work and play.
  • Vivid colors: Immerse yourself in 4K visuals with a VA panel. Enjoy true-to-life colors with 99% sRGB and 95% DCI-P3 coverage. The 1500:1 contrast ratio and HDR readiness deliver excellent depth and detail.
  • Re-engineered sound quality: Enjoy more detailed sound with spacious audio featuring greater output power, deeper frequency response and more decibel range than the previous generation.
  • Ultra-thin bezel: Designed with a sleek, modern aesthetic and an ash white finish, this display features ultra-thin bezels for a refined, minimalist design.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo accepts cookie banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; these 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. Its MCP server provides screenshot, page-info, and PDF tools for AI agents. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

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

Learn about ScreenshotNeo, or sign up free for 1,000 screenshots a month with no card.

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 regular screenshot call set Retina resolution by itself?

No. Configure Chrome’s device scale factor separately through Chrome DevTools Protocol.

Best Value
Dell 27 Monitor S2725QC, 4K UHD IPS, 120Hz, 99% sRGB, 4ms, FreeSync Premium
  • Low blue light: The improved ComfortView Plus reduces harmful blue light emissions to ≤35%, for all-day comfort without sacrificing color accuracy.
  • Refresh rate: A smooth, tear-free experience with AMD FreeSync Premium (refresh rate up to 120Hz) and an ultra-low 0.03ms response time create a captivating experience for work and play.
  • Vivid colors: Immerse yourself in breathtaking 4K visuals with in-plane switching technology. Enjoy vibrant colors with 99% sRGB. The 1500:1 contrast ratio and HDR readiness deliver excellent depth and detail.
  • Re-engineered sound quality: Enjoy more detailed sound with spacious audio featuring greater output power, deeper frequency response and more decibel range than the previous generation.
  • Easy connectivity: Keep your desk organized and clutter-free with a single USB-C cable (up to 65W power delivery).

How can I check whether Chrome is using the intended density?

Inspect the saved image’s pixel dimensions and check the page’s window.devicePixelRatio alongside its CSS viewport dimensions.

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.

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.

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
Windows Errors? Fix Them Before They SpreadFree repair scan

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.