Use Chrome DevTools Protocol (CDP) from Selenium when you need one PNG containing the whole document. Navigate with ChromeDriver, wait for the page to finish rendering, call Page.captureScreenshot with beyond-viewport capture enabled, decode the returned Base64 string, and write the bytes to a file. If that parameter is not supported by your Chrome/CDP combination, resize the window to the document dimensions or capture overlapping tiles and stitch them.
What Selenium’s screenshot methods actually capture
driver.get_screenshot_as_file("viewport.png") and driver.save_screenshot("viewport.png") save the current window view as a PNG. They are therefore viewport captures unless you first change the window or use a full-document mechanism.
The Python bindings also document get_full_page_screenshot_as_file(), get_full_page_screenshot_as_png(), and get_full_page_screenshot_as_base64(). Those methods are described in the older bindings API and are associated with Firefox behavior; do not assume that ChromeDriver supplies the same methods. For Chromium, use Selenium’s CDP execution hook or a resize/tile fallback.
Prerequisites and a stable ChromeDriver session
- Python 3 and the Selenium Python package (
pip install -U selenium). - Google Chrome or Chromium, with a ChromeDriver version compatible with the deployed browser. Selenium Manager may locate a driver automatically, but your CI image still needs a compatible browser.
- A URL that the test can access, plus any required cookies, credentials, headers, or viewport settings.
This baseline creates a driver and loads a page. Replace the placeholder wait with a condition that represents your application’s ready state.
#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
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--headless=new")
options.add_argument("--window-size=1440,900")
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com/long-page")
# Wait for application-specific content here.
finally:
driver.quit()
Method A: capture the full document through CDP
Chromium WebDriver exposes Chrome DevTools Protocol commands through execute_cdp_cmd. The following routine asks the Page domain for PNG output, captures beyond the viewport, decodes the response, and writes full-page.png.
import base64
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--headless=new")
options.add_argument("--window-size=1440,900")
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com/long-page")
# Add an explicit wait for the page's meaningful content.
result = driver.execute_cdp_cmd(
"Page.captureScreenshot",
{
"format": "png",
"captureBeyondViewport": True,
"fromSurface": True,
},
)
with open("full-page.png", "wb") as image_file:
image_file.write(base64.b64decode(result["data"]))
finally:
driver.quit()
Why this is the preferred Chrome path
It leaves the page’s layout width alone and asks Chrome’s rendering surface for content outside the visible viewport. The returned data field is Base64, so decoding it is required before opening the file as an image.
When CDP returns only the viewport
captureBeyondViewport and related fields are protocol-version-sensitive. Chrome, ChromeDriver, Selenium, and CDP evolve independently. If the image is still viewport-sized, check the protocol supported by the installed Chrome version, upgrade or align the browser and driver, and use Method B rather than silently accepting a cropped result.
Method B: resize the browser to the document
When beyond-viewport capture is unavailable, measure the document with JavaScript, resize the window, then use Selenium’s ordinary PNG method.
Recommended Free Tools
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
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--headless=new")
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com/long-page")
width = driver.execute_script(
"return Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);"
)
height = driver.execute_script(
"return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);"
)
driver.set_window_size(width, height)
# Wait for fonts, images, and lazy content before this call.
driver.get_screenshot_as_file("full-page.png")
finally:
driver.quit()
Limits of resizing
Window dimensions can be constrained by browser chrome, device-pixel-ratio scaling, headless-mode behavior, and maximum bitmap dimensions. A very tall page can exceed Chrome or image-library limits. Some pages also recalculate their responsive layout after resizing, so verify that the resulting width is the one your test intends.
Method C: scroll, capture, and stitch tiles
Use tiled capture for documents that exceed a single bitmap’s limits or contain sections that render only after scrolling. Capture a consistent viewport at successive scroll positions, then stitch the PNGs with an image library. Overlap adjacent tiles slightly so rounding does not create gaps, and crop the overlap during assembly.
Sticky headers and fixed controls
A fixed or sticky element appears in every tile and can obscure content. Before capture, temporarily hide it with injected CSS, record its height and remove the repeated region while stitching, or capture sections with a layout-specific offset. Do not hide content that the screenshot is meant to document.
Make dynamic pages capture-ready
Navigation completion is not the same as visual readiness. Build a deliberate readiness phase before measuring or capturing.
- Wait for the application state. Use an explicit Selenium wait for a meaningful selector, such as the report container or a “loaded” marker, rather than an arbitrary short sleep.
- Load lazy content. Scroll through the document or trigger the application’s lazy-load mechanism, then wait for image elements to report complete and measure height again.
- Stabilize animation. Disable transitions and animations with temporary CSS, or wait for a stable frame when pixel comparisons matter.
- Set identity and geography. Apply the required cookies, authentication, user agent, timezone, geolocation, and viewport before navigation; otherwise the page may render a different document.
- Check overlays. Consent dialogs, newsletter popups, chat widgets, fixed banners, and modal backdrops can cover content or change height. Close them deliberately or include them intentionally.
- Validate the artifact. Confirm that the file exists, opens as a PNG, and has expected dimensions before publishing it or using it in a test.
A reusable Python implementation with waits and checks
import base64
import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
URL = "https://example.com/long-page"
OUT = "full-page.png"
options = Options()
options.add_argument("--headless=new")
options.add_argument("--window-size=1440,900")
driver = webdriver.Chrome(options=options)
try:
driver.get(URL)
wait = WebDriverWait(driver, 30)
wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "main")))
# Give fonts and lazy content a chance to settle; replace with app-specific waits.
driver.execute_script("return document.fonts ? document.fonts.ready : Promise.resolve();")
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
driver.execute_script("window.scrollTo(0, 0);")
result = driver.execute_cdp_cmd(
"Page.captureScreenshot",
{"format": "png", "captureBeyondViewport": True, "fromSurface": True},
)
with open(OUT, "wb") as image_file:
image_file.write(base64.b64decode(result["data"]))
finally:
driver.quit()
if not os.path.isfile(OUT) or os.path.getsize(OUT) == 0:
raise RuntimeError("Screenshot was not written")
The JavaScript execution shown above returns a promise in browsers that support document.fonts.ready; Selenium’s script execution does not automatically wait for that promise. For strict font readiness, use Selenium’s asynchronous script API or an explicit condition that checks the fonts and critical images in your page.
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.
Choosing the method
| Situation | Recommended approach | Important trade-off |
|---|---|---|
| Normal Chrome page, one document-sized PNG | CDP Page.captureScreenshot |
Capture parameters depend on the installed CDP version. |
| CDP parameter unavailable | Measure dimensions, resize, then call get_screenshot_as_file |
Window, DPR, responsive-layout, and bitmap limits apply. |
| Extremely tall or independently lazy-loaded sections | Scroll-and-stitch tiles | Assembly must handle overlap, sticky elements, and animation. |
| Only the visible state is needed | save_screenshot or get_screenshot_as_file |
It is not a full-document capture. |
Troubleshooting common failures
The output contains only the first viewport
Cause: a normal WebDriver screenshot was used, or CDP ignored an unsupported beyond-viewport field. Fix: inspect image dimensions, align Chrome/ChromeDriver/Selenium versions, and switch to the resize or tile method.
The bottom of the page is blank
Cause: lazy images or infinite-scroll content was never triggered. Fix: scroll incrementally, wait for the network/application’s loaded marker, and measure height again immediately before capture.
The screenshot is clipped or the driver rejects the window size
Cause: browser or operating-system bitmap limits, device-pixel-ratio scaling, or an invalid window dimension. Fix: reduce the capture width, use headless mode consistently, or tile the document.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Fonts, charts, or animations differ between runs
Cause: capture occurred before web fonts and client-side rendering settled, or an animation was sampled at a different frame. Fix: wait on the relevant DOM state, freeze animations, and keep viewport, timezone, locale, and data inputs constant.
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
A banner covers the page
Cause: a consent, newsletter, chat, or modal overlay remained open. Fix: provide the required consent state, close the overlay through the same user flow as the test, or deliberately hide it with test-only CSS.
Chrome will not start in CI
Cause: missing browser dependencies, sandbox restrictions, or an incompatible driver. Fix: use a maintained Chrome image, verify the browser and driver versions together, and capture the driver’s startup error rather than masking it with retries.
Authenticated content is missing
Cause: the session was captured before login cookies were set or the page redirected to a sign-in route. Fix: authenticate first, wait for a post-login selector, and verify the current URL and key content before capture.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchReliability, performance, and storage considerations
Full-page PNGs can be large, especially at high device-pixel ratios. Keep a predictable viewport and color scheme, and choose JPEG or WebP only if your downstream comparison accepts lossy or alternate encoding. Repeatedly launching Chrome is slower than reusing a carefully reset driver, but reuse must clear cookies, local storage, service workers, and page state between jobs. Set a page-load or script timeout, always quit the driver in finally, and save diagnostic HTML, console logs, and dimensions when a capture fails. For visual regression, compare dimensions first, then pixels; a responsive breakpoint change can invalidate a pixel diff even when the page is healthy.
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.
Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server when you do not want to maintain ChromeDriver. One GET request returns a PNG, JPEG, WebP, or PDF. Its capture can accept consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before the shot; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. AI agents can call its take_screenshot, get_page_info, and capture_pdf MCP tools from Claude, Cursor, or another MCP client.
See the ScreenshotNeo documentation for parameters. The same call works from a shell:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
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}`);
Every plan includes its features. The Free plan provides 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots, with yearly billing giving two months free. Create a free ScreenshotNeo account to try the 1,000 monthly screenshots.
Frequently Asked Questions
Can I use Selenium’s Firefox full-page method with ChromeDriver?
No. The documented full-page methods in the older Python bindings are associated with Firefox behavior; ChromeDriver should use CDP, resizing, or tiled capture.
Should a full-page screenshot be PNG or JPEG?
PNG is the safest default for text and pixel comparisons. Choose JPEG or WebP only when your consumer accepts their compression and color characteristics.
Why does a page become different after I resize the window?
Responsive CSS can cross a breakpoint when the viewport changes. Capture at the intended width with CDP, or treat the resized result as a separate layout.
Is a PDF a substitute for a full-page PNG?
Only when your requirement is paginated document output. A PDF has different pagination, fonts, and print CSS from a single raster image.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →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.

