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

In the Splinter 0.21.0 documentation, browser.screenshot() uses unique_file=True by default. Splinter says the resulting filename includes a path to the system temporary directory and extra characters at the end to make it unique. The method returns the full filename, so you can use or print the path instead of trying to predict it. The docs describe the behavior, but do not specify the character-generation algorithm or promise a formal collision-proof guarantee.

What Splinter does when you call screenshot()

Splinter’s screenshot method captures the current page and saves the image locally. Its documented signature in version 0.21.0 is:

browser.screenshot(name='', suffix='.png', full=False, unique_file=True)

With the default unique_file=True, Splinter describes the filename as including a system temporary-directory path and extra trailing characters. Those additions are intended to ensure uniqueness. The important practical detail is that screenshot() returns the full filename. Save that return value if later code needs to open, move, upload, or report the screenshot.

The API reference does not explain how the extra characters are generated. It does not establish that they are random, identify a length or format, or give a mathematical guarantee that two filenames can never collide. Treat the documented behavior as a convenient way to obtain a distinct temporary filename, not as a naming algorithm your application should parse or depend on. See the Splinter 0.21.0 Chrome WebDriver reference and the Splinter 0.21.0 DriverAPI reference.

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

What the screenshot arguments control

Argument Documented behavior When to use it
name The screenshot filename supplied by the caller; its default is an empty string. Use it to identify the screenshot or provide a destination path, following the path guidance below.
suffix The filename extension; the documented default is .png. Set it when you want a different extension, and keep it consistent with the image format you intend to save.
full Whether to take a full screenshot; the default is False. Use True when you want a full-view capture rather than the default capture.
unique_file When True (the default), the filename includes a path to the system temporary directory and extra characters at the end. Keep the default when you want Splinter to generate a unique temporary filename. Set it to False when you need to manage the name yourself.

The screenshot guide says to use an absolute path when specifying where to save an image; without an absolute path, the screenshot is saved in a temporary file. Its example also uses full=True for a full-view screenshot. Read the Splinter 0.21.0 Screenshot guide for that path guidance. The exact interaction between a caller-provided path and unique naming is not described as an algorithm in the reference, so do not assume that a generated temporary name will preserve a particular directory or basename.

Use the returned path instead of guessing it

Call the method on an already-open Splinter browser, then retain the returned value. This example leaves the default uniqueness and PNG suffix enabled:

# browser is an existing Splinter browser with a page loaded.
screenshot_path = browser.screenshot(name="account-page")
print(screenshot_path)

The name argument gives the screenshot a caller-supplied name, while unique_file remains enabled because it is not overridden. Use the value assigned to screenshot_path as the authoritative path. Do not reconstruct it from name or make assumptions about the extra trailing characters.

For a full capture, set full=True explicitly:

screenshot_path = browser.screenshot(
    name="long-page",
    full=True,
)
print(screenshot_path)

The method still returns the full filename. The documentation defines full as the option for a full screenshot, but does not specify capture dimensions, image stitching details, or how every supported driver implements that capture. Splinter’s repository describes it as a Python API for web application automation and lists Selenium, Django, Flask, and ZopeTestBrowser driver support; do not assume driver-specific screenshot details are identical. See the Splinter repository.

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

Choose between a generated temporary name and your own path

If the file is an intermediate artifact, the default generated filename is useful: it avoids having to invent a unique name for each call, and the returned path tells you where Splinter saved it. If the screenshot must land at a known location for a later build step or a human review, use an absolute path as the screenshot guide recommends and manage naming deliberately. The docs do not promise that setting unique_file=False will create missing directories or overwrite an existing file safely; make those decisions in your own code.

For example, a controlled output directory can be prepared with Python’s standard library. Supply a path appropriate to the operating system running the script:

from pathlib import Path

output_dir = Path("/absolute/path/to/screenshots")
output_dir.mkdir(parents=True, exist_ok=True)

# browser is an existing Splinter browser with a page loaded.
screenshot_path = browser.screenshot(
    name=str(output_dir / "home-page"),
    suffix=".png",
    unique_file=False,
)
print(screenshot_path)

This example demonstrates caller-managed naming, not Splinter’s generated-name mechanism. Choose a fresh name for each capture if you do not want one run to replace a file from another run. The guide’s absolute-path advice applies to selecting a destination; verify the resulting path in your environment, especially when moving code between operating systems or running it inside a container.

Practical filename patterns for repeated captures

Do not parse the extra characters in a unique filename to derive an identifier. If your application needs a stable label, keep that label separately and associate it with the returned path. For example, a test can record both a case name and the generated image path:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
case_name = "checkout-with-valid-card"
screenshot_path = browser.screenshot(name=case_name)

print(f"{case_name}: {screenshot_path}")

For repeatable output intended for a report, use an absolute output directory and create distinct names yourself. Avoid using a constant basename across parallel work unless your own code prevents workers from targeting the same file. Splinter’s documented default is designed to add uniqueness to its generated filename, but the documentation does not describe a concurrency protocol or an overwrite guarantee for caller-controlled filenames.

The suffix argument controls the extension shown in the method signature, with .png as the default. If you supply another suffix, ensure the resulting filename and actual capture format agree with what your surrounding tooling expects; the cited API description identifies this argument as a suffix but does not document format-conversion behavior. For a normal PNG, leaving the default alone is the least ambiguous choice.

Common problems and how to diagnose them

  • You cannot find the screenshot. With no absolute destination path, the guide says the image is saved in a temporary file. Capture the return value and print it, rather than searching only the current working directory.
  • The printed filename is not the name you expected. With unique_file=True, extra characters are part of the documented behavior. Use the returned full filename; do not attempt to calculate the suffix yourself.
  • Two captures target the same chosen name. If you disable uniqueness and supply a fixed path, your own naming scheme must prevent conflicts. Generate distinct names or keep the default unique behavior where it fits the workflow.
  • A full capture is not what you expected. Confirm that the call uses full=True; the documented default is False. The API reference does not specify every browser driver’s implementation details, so inspect the result with the driver and page you actually use.
  • The file extension is unexpected. The documented default suffix is .png. Check the explicit suffix passed by your code and whether your downstream tool expects the same extension.
  • A screenshot call fails before returning a path. The documentation cited here explains naming and options, not all browser startup, navigation, or driver errors. First check that the browser has been initialized and that the page is in a capturable state; then consult the documentation for the specific driver and error you receive.
  • Your code relies on a different default. The cited pages identify the documented version as Splinter 0.21.0. Check the version installed in your own environment before relying on the signature or defaults: package behavior can differ from documentation for another release.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is to request a screenshot of a publicly reachable page rather than capture a page through an existing Splinter session, ScreenshotNeo is a website screenshot API and MCP server for developers. A single request can return an image or PDF. Here is the Python request pattern, saving the response body as a WebP file:

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)

See the ScreenshotNeo API documentation for request options and setup. It accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and each response indicates the page verdict and billing status in headers. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents using Claude, Cursor, or another MCP client. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is available on every plan.

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

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

Version scope

This explanation follows the Splinter documentation pages identifying version 0.21.0. The Chrome WebDriver page and shared DriverAPI page agree on the method signature and unique_file description. Check your installed Splinter version when applying these defaults to a different release. Nothing in those references identifies a particular random-number generator, exact temporary-file naming algorithm, or formal guarantee against collisions.

Frequently Asked Questions

Does Splinter document the exact characters appended to a unique filename?

No. The 0.21.0 API references describe extra trailing characters but do not specify their format or how they are generated.

Does Splinter’s unique filename option guarantee that collisions are impossible?

The documentation says the extra characters are there to ensure uniqueness, but it does not state a formal collision-proof guarantee.

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

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.