Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
“Screenshot parameter is not valid” is a symptom, not a diagnosis. The wording appears in a historical 2017 C# question involving InternetExplorerDriver, but the indexed record does not include enough code or the accepted answer to establish one universal fix. Treat your failure as a boundary problem: determine whether the screenshot command failed in the browser/driver, or whether your local code failed while decoding or saving the returned image.
The workflow below gives you a minimal C# test, checks for window and driver mismatches, and separates current Internet Explorer compatibility issues from the older report.
What the message actually tells you
WebDriver’s screenshot and element-screenshot operations are browser-control commands. A language binding sends the command to a remote end (the browser driver), receives image data, and then exposes it as an object or byte array. The W3C WebDriver specification is currently a July 2, 2026 Working Draft, so treat it as a draft description of the protocol rather than an immutable final standard.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Consequently, the same text can be produced at different layers:
#1 Best Overall
- The driver or browser rejects the screenshot command.
- The test is attached to the wrong window or tab.
- The command succeeds, but local code cannot decode, copy, or save the image.
- A test framework’s screenshot hook reports a secondary error that hides the original exception.
The historical listing identifies a C#/InternetExplorerDriver context, not a verified root cause. Do not assume that changing a file extension, updating a package, or changing an output directory is the fix before you capture the complete failure.
Start with a one-operation C# reproduction
Run a fresh driver, navigate to a simple page, and invoke only the standard page screenshot API. This removes report attachments, teardown hooks, and other code that can obscure the failing operation.
-
Create a clean console test
Install the Selenium WebDriver package and the driver required by your browser. Then use a short program such as:
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.using System; using System.IO; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; class ScreenshotProbe { static void Main() { using var driver = new ChromeDriver(); driver.Navigate().GoToUrl("https://example.com"); var screenshot = ((ITakesScreenshot)driver).GetScreenshot(); var path = Path.Combine(Environment.CurrentDirectory, "probe.png"); screenshot.SaveAsFile(path); Console.WriteLine($"Saved {path}"); } } -
Record the complete failure
Keep the exception type, exact message, inner exception, stack trace, and source line. Also record Selenium package version, browser and driver versions, Windows version, local versus Remote WebDriver execution, and whether you requested a page or element screenshot.
-
Change one variable at a time
First prove that a page screenshot works. Only then test an element screenshot, a test-runner attachment, a different browser, or a remote Grid session.
Rank #2
If this probe succeeds, the screenshot command is probably healthy and your original failure is in window selection, element lookup, framework integration, or file handling. If it fails before image data is returned, inspect driver and browser logs and their compatibility.
Separate the remote command from local image handling
When the command fails
A failure returned directly by GetScreenshot() points to the browser-control path. Enable the driver’s logging, preserve the complete response, and compare the browser/driver pair with a minimal current setup. For Remote WebDriver, collect both client and server/Grid logs; a local test can pass while a node has a different browser, driver, or policy.
Free tools Windows power users keep installed
One-click scans. No signup required.
When saving or decoding fails
If GetScreenshot() returns successfully, inspect the next operation independently:
- Verify that the destination directory exists; create it before saving.
- Use a path your process can write to, rather than a protected system directory.
- Check that the stream or response remains open until the image is copied.
- Do not infer a browser failure from an image-library, permissions, or disk-space exception.
- Save the original bytes first, then perform resizing or format conversion in a separate step.
A successful temporary file proves that the remote end supplied image data; it does not prove that later report code can open it.
Check the active tab or window
WebDriver controls windows through window handles. Opening a tab or window in the operating system does not automatically make it the active WebDriver context. Capture only after selecting the intended handle.
Rank #3
string original = driver.CurrentWindowHandle;
string target = driver.WindowHandles[^1];
driver.SwitchTo().Window(target);
var shot = ((ITakesScreenshot)driver).GetScreenshot();
shot.SaveAsFile("target.png");
driver.SwitchTo().Window(original);
For deterministic diagnostics, print every handle and the current URL before the screenshot. If the new tab is still loading, wait for a page condition appropriate to your test rather than assuming that a handle switch means the document is ready. An element screenshot adds another independent requirement: the element must exist in the current document and be interactable enough for the browser to render it.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Internet Explorer and Edge: update the diagnosis for current Selenium
Selenium’s current IE guidance says: “As of June 2022, Selenium officially no longer supports standalone Internet Explorer.” That makes a 2017 InternetExplorerDriver report a historical case, not a promise that the same configuration is supported today.
If you must test legacy IE behavior
Selenium documents using Microsoft Edge in IE Compatibility Mode with the IE Driver. It also recommends the 32-bit driver because of known limitations in the 64-bit version. Treat this as an environment decision, not as proof of the original question’s cause:
- Confirm that the application genuinely requires IE-compatible behavior.
- Use the Edge IE Compatibility Mode setup documented by Selenium.
- Prefer the recommended 32-bit driver where that guidance applies.
- Keep the browser, driver, Selenium binding, and Windows architecture details in your failure report.
If a minimal screenshot works in Chrome or Edge but fails only in the legacy combination, the comparison narrows the faulty layer. It still does not identify the missing historical accepted answer.
A practical isolation matrix
Run the smallest useful comparison and write down the result for each row:
Rank #4
- Used Book in Good Condition
| Axis | First case | Comparison case | What it isolates |
|---|---|---|---|
| Execution | Local WebDriver | Remote WebDriver/Grid | Node, proxy, or server differences |
| Capture | Whole page | Element screenshot | Element lookup and rendering issues |
| Failure point | Screenshot command | Save/decode step | Remote protocol versus local I/O |
| Context | Original window | Explicitly switched handle | Wrong tab or window state |
| Legacy driver | 32-bit IE Driver | 64-bit IE Driver | Known IE-driver limitations, only where IE Driver is used |
Change only one axis per run. A matrix is useful because “works on another browser” is evidence about scope, not a universal repair.
Common symptoms and targeted fixes
The exception is thrown on GetScreenshot()
Capture the full stack trace, enable driver logs, and verify browser/driver compatibility. Reproduce on a simple page. If the failure occurs only remotely, compare node capabilities and server logs.
The screenshot object exists but SaveAsFile fails
Check the absolute path, directory creation, permissions, disk space, and file locks. Try a known writable temporary directory. Keep this investigation separate from browser troubleshooting.
Only element screenshots fail
Confirm the selector in the current frame and window, wait for the element, and test a page screenshot immediately beforehand. A page screenshot success does not validate an element selector or frame context.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Only screenshots after a new tab fail
Enumerate WindowHandles, switch explicitly, print CurrentWindowHandle and Url, then capture. Restore the original handle after the operation.
Best Value
A test framework reports “invalid parameter” during teardown
Disable automatic screenshot attachments and call the minimal API directly. The framework may be reporting a secondary save or conversion error while the test’s original exception is elsewhere.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Reliability and performance practices
- Take screenshots at deliberate checkpoints rather than on every polling iteration.
- Use unique filenames containing test and timestamp information to avoid concurrent overwrites.
- Capture the URL, window handle, browser capabilities, and exception alongside the image.
- For remote runs, retain server-side logs long enough to correlate the command timestamp.
- Do not “fix” intermittent failures by adding arbitrary sleeps; wait for a meaningful page or element condition.
- Keep image processing out of the command-failure path so a conversion problem cannot mask a WebDriver problem.
Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server. One request returns PNG, JPEG, WebP, or PDF, and its cleanup steps accept cookie/consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture. You can turn each cleanup step off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers identify the page verdict and billing status.
For a direct request, see the ScreenshotNeo API documentation:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
It also has an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Every plan includes the features; the Free plan provides 1,000 screenshots per month without a card, and paid plans start at $5 for 3,000 screenshots. Create a free ScreenshotNeo account to try the API.
Frequently Asked Questions
Does this message prove that the screenshot format is wrong?
No. The wording alone does not identify whether the remote command, window context, or local image handling failed.
Should I switch from PNG to JPEG first?
Treat an output-format change as a diagnostic experiment only; the available historical evidence does not establish it as a fix.
Is standalone Internet Explorer still supported by Selenium?
Selenium states that official support for standalone Internet Explorer ended in June 2022; current legacy guidance uses Edge IE Compatibility Mode with the IE Driver.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsWhat details should I include when asking for help?
Provide the full exception and stack trace, failing line, Selenium/browser/driver versions, Windows version, local or remote mode, screenshot type, and active window information.
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.

