October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

Selenium Screenshots vs. Chrome DevTools: Which Should You Use?

Selenium’s standard screenshot command is the portable viewport option. CDP adds Chrome-specific format, quality, clip, and beyond-viewport controls, but full-page results need testing.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Selenium’s standard screenshot command for routine, portable test evidence; use Chrome DevTools Protocol (CDP) when you need Chrome-specific options such as a crop region, image format, JPEG quality, or a request to capture beyond the viewport. Neither choice guarantees a reliable full-page image on every page: verify the result in the browser and page you actually target.

What the two screenshot methods are

Selenium exposes the WebDriver screenshot command through its language bindings. The W3C WebDriver specification defines it as a screenshot of the top-level browsing context’s visual viewport. Selenium also offers a separate element screenshot operation. W3C WebDriver specification, screen capture; Selenium screenshot documentation.

CDP’s Page.captureScreenshot is a Chrome DevTools Protocol command. It accepts options for the output format, JPEG quality, an optional clip rectangle, and whether to request capture beyond the viewport. In the current protocol documentation, captureBeyondViewport defaults to false. The Selenium-maintained Chromium v136 protocol definition labels that option experimental; check the protocol version paired with your browser rather than assuming that snapshot describes every Chrome release. CDP Page.captureScreenshot; Selenium’s Chromium v136 protocol definition.

At a glance: Selenium WebDriver vs. CDP

Decision Selenium WebDriver screenshot CDP Page.captureScreenshot
Interface Standard WebDriver screenshot command exposed by Selenium bindings. Chrome DevTools Protocol Page-domain command.
Default scope Top-level browsing context’s visual viewport. Page screenshot; beyond-viewport capture defaults to false in current protocol documentation.
Element or region A separate element screenshot captures the visible region after scrolling the element into view. An optional clip rectangle specifies a region.
Image settings Core command captures an image; Selenium’s documented examples save screenshots to common image files. Supports PNG, JPEG, or WebP; JPEG quality is configurable.
Portability The natural starting point for a WebDriver-based multi-browser workflow, because WebDriver is a W3C standard. Chrome-specific; support depends on the browser, protocol version, and client used to send the command.
Full-page capture The standard command is viewport-based; capturing the full document requires another supported mechanism or a workaround. Offers captureBeyondViewport, but behavior needs validation on the target page and browser.

Choose the method for the evidence you need

Use Selenium’s standard screenshot command for routine test output

If your test already runs through WebDriver and you want a viewport image for a test artifact, bug report, or failure record, the standard command keeps capture in the same workflow. Selenium documents screenshot APIs for Python, Java, C#, Ruby, JavaScript, and Kotlin. Selenium screenshot documentation.

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

Use an element screenshot for focused evidence

When you need one visible component rather than the whole viewport, use WebDriver’s element screenshot operation. The specification describes capturing the visible region of the element’s bounding rectangle after it has been scrolled into view. This is distinct from the driver-level viewport screenshot. W3C WebDriver specification, screen capture.

Use CDP when its Chrome-specific controls matter

Choose Page.captureScreenshot if you need a clip rectangle, a choice of PNG, JPEG, or WebP, configurable JPEG quality, or a beyond-viewport request. These controls are useful when the capture requirements are specific enough to justify using Chrome’s protocol rather than WebDriver’s standard screenshot command. CDP Page.captureScreenshot.

Take a viewport screenshot with Selenium in Python

This minimal example opens a page, saves the current visual viewport to page.png, and closes the browser:

from selenium import webdriver

 driver = webdriver.Chrome()
 try:
     driver.get("https://example.com")
     driver.save_screenshot("page.png")
 finally:
     driver.quit()

The leading spaces before driver in a copied code block can cause an indentation error at module level. Use this correctly aligned version to run it:

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

driver = webdriver.Chrome()
try:
    driver.get("https://example.com")
    driver.save_screenshot("page.png")
finally:
    driver.quit()

For an element-level capture, locate the element and call its screenshot method, for example element.screenshot("element.png"). The exact API spelling and return format can vary by language binding; consult the relevant Selenium binding documentation. Selenium screenshot documentation.

Capture with CDP

CDP returns base64-encoded image data. The parameters and the mechanism for sending a command depend on the Chrome protocol version and client library, so there is no single client-independent command line for invoking it. Use the CDP client available in your automation setup, send Page.captureScreenshot with the options you need, then base64-decode the returned data value and write the bytes to a file. CDP Page.captureScreenshot.

  • format: choose PNG, JPEG, or WebP.
  • quality: set JPEG quality when using JPEG output.
  • clip: specify a rectangle to capture a region.
  • captureBeyondViewport: request capture beyond the viewport; the current protocol docs give it a default of false.

Because CDP is Chrome-specific and protocol support can vary, verify the command and options against the Chrome version and client you run. The current tot documentation is mutable, while the linked Chromium v136 definition is a version-specific snapshot, not a compatibility matrix.

Full-page screenshots: validate the page, not just the flag

Selenium’s standard screenshot command is defined around the visual viewport, so it does not by itself promise a full-document image. CDP provides captureBeyondViewport, but the existence of that option is not a guarantee that toggling it produces a correct full-page capture for every layout or browser version. W3C WebDriver specification, screen capture; CDP Page.captureScreenshot.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Inspect the output dimensions and confirm the bottom of the page is present.
  • Test lazy-loaded images and content that appears only after scrolling or interaction.
  • Check sticky or fixed headers and other elements that may behave differently in a tall capture.
  • Repeat the check at the actual viewport, browser version, and protocol pairing used in your test environment.

These checks matter because capture scope and protocol options do not establish how a specific dynamically rendered page will appear in the resulting image.

Rank #4
The Web Testing Handbook
  • Used Book in Good Condition

Or skip the browser setup

If your goal is a screenshot of a public web page rather than browser-driven test evidence, ScreenshotNeo takes a screenshot or PDF with one GET request. It removes cookie and consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. It also has an MCP server for AI agents, and includes 1,000 screenshots a month free with no card; paid plans start at $5 for 3,000.

cURL example (see the ScreenshotNeo API documentation):

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

Sign up for 1,000 free screenshots a month, with no card required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

The image shows only part of the page

The standard WebDriver screenshot covers the visual viewport, not automatically the full document. For a full-page requirement, use a supported alternative or CDP’s beyond-viewport option and check the result on the target page.

The CDP command or parameter is rejected

Check the Chrome version, protocol version, and client library together. CDP is Chrome-specific, the tot protocol reference changes, and the Chromium v136 definition marks captureBeyondViewport experimental. An option shown in one protocol snapshot may not be supported identically in another pairing.

The saved file is missing or cannot be opened

For Selenium, check that the process can write to the destination path and that the screenshot call returned successfully before the driver is closed. For CDP, confirm that you base64-decode the response’s image data before writing bytes; saving the base64 text as though it were image bytes will not produce a normal image file.

The full-page image omits or duplicates dynamic content

Check whether the page loads content lazily, uses sticky or fixed elements, or changes layout after scrolling. Compare the output against the actual page under the same viewport and browser version; neither a viewport screenshot nor the CDP option alone establishes correct handling for every dynamic page.

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

Frequently Asked Questions

Can I use CDP screenshots with a browser other than Chrome?

CDP is Chrome’s protocol, so it is not the portable choice for a multi-browser WebDriver workflow. The WebDriver screenshot command is the standard starting point for that use case.

Does Selenium’s element screenshot capture the whole element, even if it is taller than the viewport?

The WebDriver specification describes the element screenshot as the visible region of its bounding rectangle after the element has been scrolled into view; do not assume it captures every offscreen part.

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.

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. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
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.