To capture an entire search engine results page (SERP) in one image with Python Selenium and headless Chrome, use Chrome DevTools Protocol (CDP) through Selenium’s execute_cdp_cmd method. Measure the page’s content dimensions, then call Page.captureScreenshot with a document-sized clip and captureBeyondViewport enabled. Decode the returned base64 data and save it as a PNG.
Capture a full-page SERP with Selenium and CDP
A standard WebDriver screenshot saves the current browser window; it does not automatically include the whole document. CDP’s Page.captureScreenshot command accepts a clip rectangle and a captureBeyondViewport option, which lets you request an image extending beyond the visible viewport. Selenium exposes CDP commands through execute_cdp_cmd.
The example below assumes Python, Selenium, Chrome, and a compatible ChromeDriver are installed and configured. Replace the example URL with the SERP you are authorized to capture. The CDP documentation is version-sensitive, so verify the metric names and command support for your installed Chrome version.
Runnable capture pattern
import base64
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
url = "https://www.google.com/search?q=selenium"
options = Options()
options.add_argument("--headless")
options.add_argument("--window-size=1440,1000")
driver = webdriver.Chrome(options=options)
try:
driver.get(url)
# Replace this with a page-specific condition if the SERP has
# dynamically rendered content that must be present in the image.
WebDriverWait(driver, 20).until(
lambda d: d.execute_script("return document.readyState") == "complete"
)
metrics = driver.execute_cdp_cmd("Page.getLayoutMetrics", {})
size = metrics.get("cssContentSize", metrics.get("contentSize"))
if size is None:
raise RuntimeError(
"Could not find document content dimensions in CDP metrics"
)
result = driver.execute_cdp_cmd(
"Page.captureScreenshot",
{
"format": "png",
"captureBeyondViewport": True,
"clip": {
"x": 0,
"y": 0,
"width": size["width"],
"height": size["height"],
"scale": 1,
},
},
)
with open("serp.png", "wb") as image_file:
image_file.write(base64.b64decode(result["data"]))
finally:
driver.quit()
Install Selenium with python -m pip install selenium if it is not already available. Chrome and a compatible driver must also be available to Selenium. Recent Selenium setups can manage driver installation, but the example does not guarantee that every environment will configure it automatically.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- Compatible with Nintendo Switch 2’s new GameChat mode
- Auto-Light Balance: RightLight boosts brightness by up to 50%, reducing shadows so you look your best—compared to previous-generation Logitech webcams (1)
- Privacy with a Slide: The integrated webcam cover makes it easy to get total, reliable privacy when you're not on a video call
- Built-In Mic: The built-in microphone lets others hear you clearly during video calls
- Easy Plug-And-Play: The Brio 101 works with most video calling platforms, including Microsoft Teams, Zoom and Google Meet—no hassle; it just works
Why the capture sequence matters
- Start Chrome headlessly. Headless mode controls how Chrome runs; it does not itself make a screenshot full-page. The CDP capture parameters provide that behavior.
- Load and wait for the content you need. A page-ready state is only a basic starting point. Search pages can insert modules later or defer images until they approach the viewport. Use a bounded, page-specific readiness condition when the screenshot must include those elements.
- Measure after loading.
Page.getLayoutMetricssupplies document dimensions. The example checkscssContentSizefirst and falls back tocontentSize, but metric fields can vary with protocol versions. - Capture the measured rectangle. The clip starts at
x: 0,y: 0, spans the measured width and height, and usesscale: 1. The response’sdatavalue is base64-encoded image content. - Write the image bytes. Base64-decode the response and save it with a matching extension. This example requests PNG.
The CDP protocol also supports JPEG and WebP formats. Its reference marks captureBeyondViewport as experimental and says it defaults to false, so do not assume the parameter or metric shape is identical across all Chrome/CDP versions. See the Chrome DevTools Protocol Page domain and Selenium’s Chromium WebDriver API.
Make SERP captures repeatable
A screenshot records the page state at capture time, not a canonical or guaranteed-complete version of search results. SERPs can vary with location, language, session, personalization, timing, and dynamic modules. If you compare captures, keep the browser version, viewport, locale, session conditions, query, and readiness criteria consistent, and record those conditions alongside the image.
Rank #2
- Compatible with Nintendo Switch 2’s new GameChat mode
- Crisp HD 720p/30 fps video calls with diagonal 55° field of view and auto light correction. Compatible with popular platforms including Skype and Zoom.
- The built-in noise-reducing mic makes sure your voice comes across clearly up to 1.5 meters away, even if you’re in busy surroundings.
- C270’s RightLight 2 feature adjusts to lighting conditions, producing brighter, contrasted images to help you look good in all your conference calls.
- The adjustable universal clip lets you attach the camera securely to your screen or laptop, or fold the clip and set the webcam on a shelf. You’re always ready for your next video call.
Lazy-loaded and delayed content
If results or images appear only after scrolling, a single wait for document.readyState may be insufficient. Use a bounded wait for the relevant selector or page-specific condition. Controlled scrolling can trigger deferred content, but it changes the scroll position and may affect sticky elements. After scrolling and waiting for the page to settle, measure the document dimensions again before capturing.
Image size and long documents
A very tall page can produce a large image and consume substantial browser and process memory. If capture fails or a single enormous image is unsuitable, capture viewport-sized sections and stitch them as a fallback. Stitching is more involved and can introduce visible seams, duplicate or missing content, and inconsistencies from sticky overlays or page changes between captures.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Troubleshoot common capture problems
- The image ends at the viewport. Check that you are using
Page.captureScreenshotwithcaptureBeyondViewport: trueand a clip whose height covers the measured document. A regular WebDriver window screenshot is not the same operation. - CDP reports an unknown command or parameter. Chrome/CDP support is version-dependent. Check the installed browser’s protocol support and confirm that the command and
captureBeyondViewportparameter are available. The tip-of-tree protocol reference can change and may not match an older installed browser; the CDP overview warns that the protocol can change in ways that break clients. - The script cannot find a content-size field. Inspect the keys returned by
Page.getLayoutMetricsfor your installed version, then use its document content-size metric. Do not substitute viewport dimensions: that would clip the page. - Some results or images are missing. The page may not have finished inserting them, or lazy loading may require scrolling. Wait for the specific content, allow it to settle, and remeasure before capture.
- The screenshot is blank or unexpectedly small. Confirm navigation reached the intended page, the capture ran after the relevant readiness condition, and the clip width and height are positive document dimensions. Inspect the returned CDP response and browser logs if the command fails.
- Capture fails on an extremely tall page. Reduce the captured area if acceptable or use chunked viewport captures and stitching, accounting for seams, sticky UI, and timing differences.
Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server. A single GET request can return an image or PDF; the service accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets. Those cleanup steps can be disabled individually. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, with response headers indicating the page verdict and billing status.
For a SERP capture, request the target URL directly. See the ScreenshotNeo documentation for API options and setup.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://www.google.com/search?q=selenium -o shot.webp
ScreenshotNeo also offers an MCP server for AI agents, with tools including take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Try it by signing up for free.
Rank #3
- 【Full HD 1080P Webcam】Powered by a 1080p FHD two-MP CMOS, the NexiGo N60 Webcam produces exceptionally sharp and clear videos at resolutions up to 1920 x 1080 with 30fps. The 3.6mm glass lens provides a crisp image at fixed distances and is optimized between 19.6 inches to 13 feet, making it ideal for almost any indoor use.
- 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 8, 10 & 11 / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
- 【Built-in Noise-Cancelling Microphone】The built-in noise-canceling microphone reduces ambient noise to enhance the sound quality of your video. Great for Zoom / Facetime / Video Calling / OBS / Twitch / Facebook / YouTube / Conferencing / Gaming / Streaming / Recording / Online School.
- 【USB Webcam with Privacy Protection Cover】The privacy cover blocks the lens when the webcam is not in use. It's perfect to help provide security and peace of mind to anyone, from individuals to large companies. 【Note:】Please contact our support for firmware update if you have noticed any audio delays.
- 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 10 & 11, Pro / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
Use SERP screenshots responsibly
Search results can contain personalizing or location-dependent content, and automated access may be subject to the search engine’s terms and applicable access rules. Check those rules before collecting SERP screenshots, particularly for repeated or large-scale capture.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Quick Recap
Best Value
- Compatible with Nintendo Switch 2’s new GameChat mode
- HD lighting adjustment and autofocus: The Logitech webcam automatically fine-tunes the lighting, producing bright, razor-sharp images even in low-light settings. This makes it a great webcam for streaming and an ideal web camera for laptop use
- Advanced capture software: Easily create and share video content with this Logitech camera that is suitable for use as a desktop computer camera or a monitor webcam
- Stereo audio with dual mics: Capture natural sound during calls and recorded videos with this 1080p webcam, great as a video conference camera or a computer webcam
- Full HD 1080p video calling and recording at 30 fps. You'll make a strong impression with this PC webcam that features crisp, clearly detailed, and vibrantly colored video
Rank #4
- 1080P Webcam with Cover for Video Calls - EMEET computer webcam provides design and Optimization for professional video streaming. Realistic 1920 x 1080p video, 5-layer anti-glare lens, providing smooth video. C960 computer camera delivers 1920x1080 video with fixed focus (11.8–118.1 inches), so as to provide a clearer image. C960 USB webcam has a cover and can be removed automatically to meet your needs for privacy. For optimal image performance, use the webcam in a well-lit environment.
- Built-in 2 Omnidirectional Mics - EMEET webcam with microphone for desktop features 2 built-in omnidirectional microphones, picking up your voice to create clear audio for communication. When installing the webcam, select EMEET C960 as the default microphone input device in your computer and video applications and select C960 as the default device in Zoom/Teams and ensure microphone permissions are enabled for proper use. Please note that C960 does not include built-in speakers.
- Automatic Light Adjustment - Automatic exposure adjustment is applied in EMEET HD webcam 1080p so that the streaming webcam can deliver stable image performance. EMEET C960 camera for computer also features color adjustment and exposure optimization to help you look your best. For optimal video quality, it is recommended to use the webcam in normal or well-lit environments and select suitable video settings in your application. Proper lighting helps achieve a clearer and more balanced image.
- Plug-and-Play & Upgraded USB Connectivity - New C960 webcam features both USB Type-A & A-to-C adapter connections for wider compatibility. For stable performance, connect the webcam directly to the computer's main USB port and ensure the device is recognized correctly. If a hub or docking station is used, please ensure it provides sufficient power and stable data transmission, as limited ports may affect performance. 90° wide-angle lens captures more participants without frequent adjustments.
- High Compatibility & Multi Application - C960 webcam for laptop is compatible with Windows 10/11, macOS 10.14+, and Android TV 7.0+. Not supported: Windows Hello, TVs, tablets, or game consoles. It works with Zoom, Teams, Facetime, Google Meet, YouTube and more. Please select C960 webcam as the default camera and microphone device in your application and ensure camera/microphone permissions are enabled, especially on macOS. (Tips: Incompatible with Windows Hello)
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.

