Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Use the Chrome DevTools Protocol (CDP) through the Selenium session that your Cucumber scenario already controls. Call Page.captureScreenshot with captureBeyondViewport set to true, decode the returned Base64 data, and save it as a test artifact. If your capture logic needs the page dimensions first, call Page.getLayoutMetrics and read cssContentSize.
The exact generated DevTools classes differ between Selenium bindings and versions. The example below uses Java, Cucumber, Selenium 4, and ChromeDriver’s generic executeCdpCommand method; verify the matching Selenium and Chrome versions in your build.
What “full-page” means in a Cucumber test
A normal WebDriver screenshot records only the current viewport. A full-page capture includes content below the fold, including areas that would require scrolling. Chrome’s CDP command supports this with captureBeyondViewport; the protocol documents that option as false by default, so your test must set it explicitly.
CDP returns the image as a Base64-encoded string in the JSON response. Your step decodes that string and writes the bytes to the scenario’s artifact directory. PNG, JPEG, and WebP are supported by the protocol. JPEG and WebP are lossy formats and accept a quality value; PNG does not use quality.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Prerequisites and version checks
- A Cucumber project that creates a Chrome WebDriver session.
- Selenium 4 and a ChromeDriver/Chrome combination supported by that Selenium release.
- A step definition that can access the scenario’s existing
WebDriver. Do not start a second browser just for the screenshot. - A writable directory for screenshots, such as
target/cucumber-screenshots.
CDP is versioned. Chrome’s tip-of-tree protocol changes frequently, can break, and provides no backwards-compatibility guarantee. Selenium’s generated DevTools APIs are also version-specific. Check the Selenium API generated for the version installed in your project rather than copying a method signature from a different release.
Java Cucumber step using Selenium’s CDP bridge
The following step uses Selenium’s generic CDP bridge. It avoids binding-specific generated DevTools classes while still sending the same protocol command. It assumes your glue class receives the same driver used by the scenario.
Driver holder
package support;
import org.openqa.selenium.WebDriver;
public final class DriverHolder {
private static final ThreadLocal<WebDriver> DRIVER = new ThreadLocal<>();
private DriverHolder() {}
public static void set(WebDriver driver) {
DRIVER.set(driver);
}
public static WebDriver get() {
WebDriver driver = DRIVER.get();
if (driver == null) {
throw new IllegalStateException("No WebDriver is registered for this scenario");
}
return driver;
}
public static void clear() {
DRIVER.remove();
}
}
Register the driver in your existing Cucumber hooks. The exact setup and teardown depend on your project; the important detail is that the step and hooks share the same driver instance.
Step definition
package steps;
import io.cucumber.java.en.Then;
import org.openqa.selenium.WebDriver;
import support.DriverHolder;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class ScreenshotSteps {
@Then("I save a full-page Chrome screenshot as {string}")
public void saveFullPageScreenshot(String fileName) throws IOException {
WebDriver driver = DriverHolder.get();
if (!(driver instanceof org.openqa.selenium.chromium.ChromiumDriver chromium)) {
throw new IllegalStateException("This step requires a ChromiumDriver");
}
Map<String, Object> params = new HashMap<>();
params.put("format", "png");
params.put("captureBeyondViewport", true);
Map<String, Object> response = chromium.executeCdpCommand(
"Page.captureScreenshot", params);
Object encoded = response.get("data");
if (!(encoded instanceof String base64) || base64.isBlank()) {
throw new IllegalStateException("Chrome returned no screenshot data");
}
byte[] image = Base64.getDecoder().decode(base64);
Path output = Paths.get("target", "cucumber-screenshots", fileName)
.toAbsolutePath().normalize();
Files.createDirectories(output.getParent());
Files.write(output, image);
assertTrue(Files.size(output) > 0, "Screenshot file is empty: " + output);
}
}
A feature can invoke it like this:
Scenario: capture the whole article
Given I open "https://example.com/article"
Then I save a full-page Chrome screenshot as "article.png"
Use a unique filename when scenarios run in parallel. A common pattern is to include the scenario name, an execution identifier, or a timestamp supplied by your test framework. Keep the extension consistent with the CDP format.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteReading layout metrics before capture
You do not normally need to calculate dimensions when captureBeyondViewport is enabled. If your artifact system imposes image-size limits, or you need to log the page’s scrollable dimensions, call Page.getLayoutMetrics first. Its cssContentSize object reports the content width and height in CSS pixels.
Map<String, Object> metrics = chromium.executeCdpCommand(
"Page.getLayoutMetrics", Map.of());
@SuppressWarnings("unchecked")
Map<String, Object> content = (Map<String, Object>) metrics.get("cssContentSize");
System.out.printf("Content: %sx%s CSS pixels%n",
content.get("width"), content.get("height"));
These values describe layout space, not necessarily the number of physical pixels in the resulting file. Device scale factor, browser zoom, and the requested image format affect the output.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Choosing format, quality, and clipping
| Setting | Use it when | Notes |
|---|---|---|
format: "png" |
Assertions, text, diagrams, or lossless archives | Largest files in many cases; quality is ignored. |
format: "jpeg" |
Photographic pages where smaller files matter | Set an integer quality supported by your protocol version; compression can blur text. |
format: "webp" |
Modern pipelines that accept WebP | Confirm that downstream viewers and artifact storage support it. |
captureBeyondViewport: true |
The complete scrollable page is required | Required for a full-page result; the default is false. |
clip |
Only a known rectangle is needed | Pass an object with x, y, width, height, and scale as required by your CDP version. |
For a lossy capture, add for example params.put("quality", 85) and change the extension to .jpg or .webp. Keep format and filename aligned so artifact viewers do not misinterpret the bytes.
Make the page stable before taking the shot
A full-page image is only useful if the page has finished rendering. In your preceding Cucumber steps:
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minute- Wait for the primary content selector, not just the initial document load.
- Wait for lazy images, charts, and fonts that are part of the expected state.
- Dismiss a cookie dialog or other overlay when it would hide the content under test.
- Freeze or wait out animations if pixel comparisons are involved.
- Use deterministic test data and a fixed viewport where visual consistency matters.
CDP captures the current browser state. It does not automatically wait for network idle, scroll through every lazy-loading implementation, or remove overlays. If a site loads images only after an element enters the viewport, perform the page-specific scroll or trigger in a separate step, then capture.
Generated Selenium DevTools APIs
Selenium also ships generated DevTools bindings for particular Chrome protocol versions. Those APIs expose typed settings such as CaptureBeyondViewport and Clip. The package name and method signatures vary by language and Selenium release, so select the generated version that matches your project and inspect its documentation or IDE completion. Do not assume a class copied from a different selenium-devtools-vNN module will work unchanged.
The generic executeCdpCommand example is useful when your binding exposes that bridge and you want to send the protocol’s JSON parameters directly. If your binding does not expose it, use its generated DevTools equivalent and preserve the same protocol fields.
Troubleshooting
The image contains only the viewport
Cause: captureBeyondViewport was omitted, set to false, or replaced by a binding default.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Fix: Send the boolean value true in the Page.captureScreenshot parameters. Confirm in logs that the command being sent is the Page domain command, not WebDriver’s ordinary screenshot call.
Unknown command or CDP version error
Cause: Chrome, ChromeDriver, and Selenium do not agree on a supported protocol version, or a generated DevTools package targets another version.
Fix: Align ChromeDriver with Chrome, upgrade Selenium within your project’s compatibility policy, and use the generated DevTools module for that release. Avoid relying on the tip-of-tree protocol as a stable contract.
The step says no driver is registered
Cause: The hook created a driver but did not put it in the holder used by the step, or parallel execution reused the wrong scope.
Fix: Register the driver before the scenario’s first step, use a thread-safe or dependency-injected context, and clear it in the After hook.
The file is empty or cannot be opened
Cause: The response did not contain a non-empty data string, Base64 decoding failed, or the output directory was not writable.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Fix: Check the response before decoding, create parent directories, write the decoded bytes rather than the Base64 text, and verify the extension matches the requested format.
Content is missing or covered by a dialog
Cause: The page was captured before lazy content loaded, or a consent, newsletter, chat, or login overlay remained visible.
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 →Fix: Add an explicit wait for the content, perform any required scroll trigger, and handle the overlay in a prior test step. A screenshot command cannot infer which overlays are safe to remove.
Memory or artifact-size failures
Cause: Very tall pages produce large decoded images, especially at high device scale factors.
Fix: Capture PNG only when lossless output is needed, choose JPEG/WebP where acceptable, reduce the device scale factor, limit the page under test, or use a clip for a targeted region. Do not silently crop when the test’s purpose is full-page verification.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Parallel runs, reliability, and maintenance
- Write each scenario to its own path; otherwise parallel workers can overwrite one another.
- Attach the path or bytes to the Cucumber report after the step succeeds, and preserve the screenshot on failure for diagnosis.
- Record the browser version, Selenium version, viewport, and requested format alongside the artifact. Those details make protocol or rendering changes explainable.
- Keep the screenshot step small and deterministic. Navigation, authentication, data seeding, and overlay handling belong in separate steps.
- Review the step after Chrome or Selenium upgrades. CDP’s lack of backwards-compatibility guarantees makes version checks part of maintenance rather than a one-time setup task.
Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server when you need a clean capture without maintaining a Chrome session. One GET request returns PNG, JPEG, WebP, or a 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 disabled.
Free tools Windows power users keep installed
One-click scans. No signup required.
Only clean shots are billed. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
For the same URL used above, the one-call version is:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for all parameters. The service also supports full-page capture with lazy images loaded, CSS-selector element capture, dark mode, device presets or custom viewports, retina scale, PDF paper and page settings, custom CSS and JavaScript, clicks before capture, selector or network-idle waits, request and resource blocking, headers, cookies, user agents, Authorization, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. Parameter names used by other screenshot APIs are accepted to ease migration.
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}`);
The Free plan includes 1,000 screenshots each month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account.
Frequently Asked Questions
Can I use this with a non-Chrome browser?
The method described here is Chrome’s DevTools Protocol through Selenium’s Chromium support. Other browsers expose different automation protocols and are outside this procedure.
Do I need Page.getLayoutMetrics for every full-page screenshot?
No. It is useful when you need the page’s CSS content dimensions for logging, limits, or custom logic. captureBeyondViewport is the setting that requests content beyond the viewport.
Where should screenshots go in CI?
Write them beneath the workspace’s test-artifact directory, use unique names per scenario and worker, and configure your CI system to upload that directory after the run.
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.

