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

Set Chrome’s image content preference before creating the WebDriver session. In Selenium Python, the commonly used Chromium preference is profile.default_content_setting_values.images: 2:

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_experimental_option(
    "prefs",
    {"profile.default_content_setting_values.images": 2},
)
driver = webdriver.Chrome(options=options)

This blocks images for that Chrome session, but the preference key and numeric value are Chromium implementation details rather than a stability guarantee from Selenium. Verify the behavior with the Chrome version deployed in your environment, then inspect a representative screenshot for layout changes.

What the setting does

Chrome’s content setting for images has two states: allow (the default) and block. Selenium passes Chrome-specific preferences through ChromeOptions. The preference shown above is a practical way to select the block state before Chrome starts.

Configure it before calling webdriver.Chrome(). Changing the dictionary after the driver has launched does not retroactively change the browser profile. Use a fresh driver when you need a different image policy.

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

Blocking image content is not the same as adding display:none with CSS. The browser may lay out replaced elements, intrinsic dimensions, lazy-loading placeholders, or responsive containers differently when image resources are unavailable. Treat the resulting screenshot as a page rendered without image content, not as an original screenshot with pixels merely hidden.

Prerequisites and version checks

  • Python with Selenium installed, for example with python -m pip install selenium.
  • A Chrome installation and a compatible ChromeDriver. Selenium documents Selenium 4 compatibility with Chrome 75 and later; Chrome and ChromeDriver major versions should match. Recheck the compatibility guidance for the versions installed on your machines.
  • A URL that your test is allowed to access, plus any authentication, cookies, headers, or test data required by the page.

Because the preference is Chromium-specific, run the same configuration in the exact browser build used in CI or production capture. A preference that works in one Chrome release should not be assumed to be a permanent Selenium contract.

Complete Selenium Python example

Launch Chrome with images blocked

The following script creates a clean session, navigates to a page, waits for a page-specific element, captures a PNG, and quits reliably:

from pathlib import Path

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

TARGET_URL = "https://example.com"
OUTPUT = Path("page-without-images.png")

options = webdriver.ChromeOptions()
options.add_experimental_option(
    "prefs",
    {"profile.default_content_setting_values.images": 2},
)
# Optional: set a predictable viewport for repeatable captures.
options.add_argument("--window-size=1440,1000")

driver = webdriver.Chrome(options=options)
try:
    driver.get(TARGET_URL)

    # Replace this locator with an element that proves your page is ready.
    WebDriverWait(driver, 30).until(
        EC.visibility_of_element_located((By.TAG_NAME, "body"))
    )

    # Add waits for application-specific content before taking the shot.
    WebDriverWait(driver, 30).until(
        EC.presence_of_element_located((By.CSS_SELECTOR, "main"))
    )

    if not driver.save_screenshot(str(OUTPUT)):
        raise RuntimeError("Chrome did not report a successful screenshot")
finally:
    driver.quit()

Replace main with a selector that represents the state you actually need to capture. A generic body wait only proves that a document exists; it does not prove that a JavaScript application has finished rendering its data.

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.

Use explicit waits instead of a fixed sleep

Single-page applications can continue changing after navigation returns. Wait for a heading, chart, table, or application state that matters to your screenshot. If a page displays a loading indicator, wait for it to become invisible and then wait for the final content:

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
wait = WebDriverWait(driver, 30)
wait.until(EC.invisibility_of_element_located((By.CSS_SELECTOR, ".loading")))
wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "[data-ready='true']")))

Choose selectors that are stable in your application. Avoid making the screenshot depend on an arbitrary delay unless the page has no observable ready condition.

Capture a full-page result deliberately

save_screenshot() captures the current browser viewport. If your requirement is a full-page image, use the full-page mechanism supported by your Selenium and Chrome versions, or resize the window to the document dimensions before capturing. Verify the output on the deployed browser: image removal can change heights, wrapping, and lazy-loaded sections, so a full-page calculation made for the image-rich version may no longer fit.

Check that images were actually blocked

  1. Start a new driver with the preference configured before construction.
  2. Navigate to a page containing obvious image content.
  3. Capture the screenshot and inspect image regions, placeholders, and surrounding layout.
  4. If possible, compare the browser’s network activity or page state in your test environment to confirm that your Chrome build honored the preference.

If images still appear, first confirm that the options object passed to the constructor is the one used to create the driver. Then test a fresh profile and the exact Chrome binary used by CI. The profile.default_content_setting_values.images key and value are widely used Chromium settings, but Chrome documentation describes the allow/block content setting rather than promising this exact Selenium encoding across all versions.

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

Chrome preference versus runtime CDP control

There are two approaches developers commonly consider:

Approach When it applies What it controls Stability considerations
Chrome startup preference Before the WebDriver session starts Session-wide image content policy Simple for repeatable captures; validate the Chromium preference on your target Chrome version.
Chrome DevTools Protocol (CDP) At runtime after the browser starts Can be used for runtime network or DevTools behavior when your use case requires it Selenium describes CDP support as temporary while WebDriver BiDi is implemented. CDP is version-dependent and was not designed as a stable cross-version testing API.

For this title’s use case, start with the Chrome option. Use CDP only when you need a runtime rule that the startup preference cannot provide, and pin and test the Chrome, Selenium, and CDP versions together. Do not describe page_load_strategy="eager" or "none" as image blocking: those strategies only change when navigation returns.

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.

Navigation timing and page-load strategy

Selenium’s normal navigation waits for the browser’s normal page-load milestone. Setting page_load_strategy to eager can return at DOMContentLoaded, while none can return sooner still. Neither setting expresses Chrome’s image content policy, and both require an adequate explicit-wait strategy.

If you choose an earlier strategy, configure it before driver creation and wait for the actual screenshot state:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
options = webdriver.ChromeOptions()
options.page_load_strategy = "eager"
options.add_experimental_option(
    "prefs",
    {"profile.default_content_setting_values.images": 2},
)
driver = webdriver.Chrome(options=options)

Use this only when you understand the page’s loading behavior. Returning from get() earlier does not mean JavaScript, fonts, data requests, or layout work have completed.

Common problems and fixes

Images still show in the screenshot

  • Cause: The preference was added after the driver was created, or a different options object was passed to the constructor.
  • Fix: Add the preference before webdriver.Chrome(options=options), start a new session, and log the Chrome binary and version used by the test.
  • Cause: Your deployed Chrome release does not honor the commonly used numeric mapping.
  • Fix: Verify the allow/block setting with that browser version and test a representative page before depending on it.

The screenshot is blank or missing application content

  • Cause: The script captured immediately after navigation, before a client-rendered application populated the page.
  • Fix: Add explicit waits for the final content, not just body. Check that the URL, authentication, and required cookies are correct.
  • Cause: Blocking images changed layout or removed an element your application uses as a readiness signal.
  • Fix: Wait on text, a data attribute, or another non-image state marker and revise selectors that depended on image dimensions.

Layout shifts or content wraps differently

Image resources can provide intrinsic width and height. Without them, containers may collapse, reflow, or show placeholders. If your goal is a faithful visual baseline, do not block images. If your goal is to test text or structure without image traffic, record the altered layout as an intentional test condition.

Navigation returns too early

eager and none return before all application work is complete. Keep the default strategy while diagnosing, then add a specific wait. If you retain an early strategy, identify a deterministic ready condition and give it a timeout long enough for the slowest supported environment.

Rank #4
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

ChromeDriver or session creation fails

Check that Chrome and ChromeDriver major versions match and that the Selenium version supports your installed browser. Reproduce with a fresh, minimal script containing only the options preference. Once a minimal session starts, add viewport arguments, authentication, and waits one at a time.

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

A CDP-based solution breaks after an upgrade

CDP functionality depends on the Chrome version and Selenium’s generated support. Pin compatible versions, run the capture test in CI, and avoid treating CDP as a stable cross-browser abstraction. Prefer the startup preference when session-wide image blocking is sufficient.

Performance, reliability, and cost considerations

Blocking images can reduce image transfer and decoding work, but the actual gain depends on the page. HTML, CSS, JavaScript, fonts, analytics, video, and API requests may still load. Measure the end-to-end capture time in your own environment rather than assuming a fixed speedup.

For reliable automation:

  • Use a fresh browser session when changing image policy.
  • Keep Chrome and ChromeDriver versions aligned and test upgrades before rolling them out.
  • Use deterministic viewport dimensions and stable selectors.
  • Wait for the content state required by the screenshot.
  • Save diagnostic HTML, console logs, or a second screenshot when a capture fails, if your test policy permits.
  • Review screenshots after Chrome upgrades because browser rendering and preference behavior can change.

Selenium itself does not charge per screenshot; your costs are the compute, browser infrastructure, storage, and maintenance required to run the workflow. If you need a hosted capture endpoint instead of maintaining Chrome sessions, use the option below.

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

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request returns a PNG, JPEG, WebP, or PDF. Before capture, it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

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

Use the API documentation at https://screenshotneo.com/docs/ for authentication and options. A minimal cURL request is:

Best Value
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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

The same request in Python is:

import requests
r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`ScreenshotNeo returned ${res.status}`);
const data = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', data));

ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Its Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots, and every feature is available on every plan.

Sign up for the free ScreenshotNeo plan to get 1,000 screenshots a month without a card.

FAQ

Can I switch image blocking on and off inside one Selenium session?

Use separate Chrome sessions for predictable behavior: create one driver with the blocking preference and another with the default image setting. This avoids relying on profile changes after startup.

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

Will blocking images remove CSS background images?

Do not assume every visual image source behaves identically. Test the page type you capture, including CSS backgrounds, responsive images, lazy-loaded elements, and placeholders, and define which visual resources your test considers an image.

Should I use this setting for visual regression tests?

Only if the regression target intentionally excludes image content. For pixel comparisons of the production experience, keep the normal image policy; for text, structure, or bandwidth-focused checks, document the blocked-image condition in the test name and baseline.

Frequently Asked Questions

Can I switch image blocking on and off inside one Selenium session?

Use separate Chrome sessions for predictable behavior: create one driver with the blocking preference and another with the default image setting. This avoids relying on profile changes after startup.

Will blocking images remove CSS background images?

Do not assume every visual image source behaves identically. Test the page type you capture, including CSS backgrounds, responsive images, lazy-loaded elements, and placeholders, and define which visual resources your test considers an image.

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

Should I use this setting for visual regression tests?

Only if the regression target intentionally excludes image content. For pixel comparisons of the production experience, keep the normal image policy; for text, structure, or bandwidth-focused checks, document the blocked-image condition in the test name and baseline.

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.