Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
browser automation

How to Take a Screenshot of a Web Page with Clojure

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

Use Etaoin to drive a real browser, then call e/screenshot with a PNG path. The following example runs Chrome headlessly, opens a URL, and writes target/page.png:

(require '[etaoin.api :as e])

(e/with-chrome-headless driver
  (e/go driver "https://example.com")
  (e/screenshot driver "target/page.png"))

Etaoin creates missing parent directories for the destination. You still need a compatible browser and WebDriver installed. The guide describes Etaoin 1.1.43 with Clojure 1.10 or newer and JDK 11 or newer; treat those as the guide’s stated requirements, not as a guarantee that they are the newest releases.

What the basic Etaoin screenshot captures

e/screenshot captures the page as exposed by the browser’s screenshot implementation—normally the currently visible viewport. It saves a PNG and accepts either a string path or a java.io.File. A relative path is resolved from the Clojure process’s working directory, so use an explicit output directory in build scripts and make sure that directory is writable.

A viewport capture is not automatically a screenshot of every pixel in a long document. Full-page behavior is browser- and driver-dependent; standard WebDriver screen capture does not provide one portable guarantee for the entire scrollable document. Test the exact browser/driver pair you deploy, or use an automation API that explicitly supports full-page capture.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Prerequisites and browser setup

Add Etaoin to the project

In a tools.deps project, add Etaoin to deps.edn using the version shown in its guide:

{:deps {etaoin/etaoin {:mvn/version "1.1.43"}}}

If your project uses Leiningen or another build tool, add the same library through that tool’s normal dependency configuration. The guide describes support beginning with Clojure 1.10 and JDK 11.

Install a browser and WebDriver

Etaoin implements the WebDriver protocol. Install the browser you intend to automate and its matching driver, then put the driver executable on PATH or configure its location. Conventional executable names include:

  • chromedriver for Chrome
  • geckodriver for Firefox
  • safaridriver for Safari
  • msedgedriver for Microsoft Edge

Etaoin’s project supports Chrome, Firefox, Safari and Edge and can launch a local browser or connect to a remote WebDriver process. The guide’s test-coverage table lists Chrome and Firefox on Linux, macOS and Windows; Safari and Edge are listed on macOS, with Edge also listed on Windows. That is project test coverage, not a promise for every browser release.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Choose headless mode deliberately

Headless Chrome, Firefox and Edge are useful on CI servers because no visible window is required. The guide noted that Safari did not support headless mode as of August 2024. Safari’s behavior can change, so verify it for the browser version you deploy.

A complete Clojure example

Create a namespace such as capture.core:

(ns capture.core
  (:require [etaoin.api :as e]
            [clojure.java.io :as io]))

(defn capture-page! [url output]
  (e/with-chrome-headless driver
    (e/go driver url)
    (e/screenshot driver (io/file output))))

(capture-page! "https://example.com" "target/example.png")

The io/file form is optional; Etaoin also accepts the string "target/example.png". On success, the browser session closes when with-chrome-headless exits and the PNG remains at the requested path.

Run it

  1. Save the namespace in your project.
  2. Confirm that the browser and driver versions are compatible and that the driver is discoverable.
  3. Run the namespace with your normal Clojure command, for example clojure -M -m capture.core when your project defines that alias and main namespace.
  4. Open target/example.png and verify the captured viewport.

Do not claim that navigation means every asynchronous task has finished. Modern applications may render after the initial load event. Wait for a selector, a known state, or an application-specific delay before calling e/screenshot.

Waiting for dynamic pages

For a server-rendered page, e/go followed by e/screenshot may be sufficient. For a single-page application, wait for the element that proves the content is ready. Etaoin provides wait functions and load-strategy controls; use those rather than relying on an arbitrary sleep whenever possible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
(e/with-chrome-headless driver
  (e/go driver "https://example.com/dashboard")
  ;; Replace the query and condition with the page's ready signal.
  (e/wait-visible driver {:css ".dashboard"})
  (e/screenshot driver "target/dashboard.png"))

The exact query form depends on the Etaoin API version you install. If a site has a cookie dialog, login gate, animation or lazy-loaded image, handle that state before capture. A screenshot records what the browser has rendered at that instant; it does not infer your intended final state.

Element screenshots versus page screenshots

Use e/screenshot-element when you need one component rather than the viewport:

(e/with-chrome-headless driver
  (e/go driver "https://example.com")
  (e/screenshot-element driver {:css "header"} "target/header.png"))

The documented signature is (screenshot-element driver query file). The user guide documents element screenshots for Chrome and Firefox and warns that support is not universal across browsers. If the selector matches nothing, wait for the element or correct the query before capturing.

Capture goal Etaoin approach Important qualification
Visible page e/screenshot Usually the current viewport; scope depends on the driver.
One component e/screenshot-element Documented for Chrome and Firefox in the guide; test your browser.
Entire scrollable document Browser-specific technique or another API Not a portable guarantee of ordinary WebDriver screenshots.

Full-page screenshots: set expectations

A long page requires more than changing the output filename. Some browsers or wrappers can stitch sections or expose a full-page command; others return only the viewport. Etaoin’s ordinary screenshot API should therefore be described as a current-page capture, not as a universal full-document capture.

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

If full-page output is a hard requirement, test a representative page containing fixed headers, lazy images, very tall content and sticky elements. Check whether the resulting image includes content below the fold, whether fixed elements are duplicated, and whether the image dimensions are practical for downstream storage. Playwright, for example, documents an explicit fullPage option and element locator screenshots, but that behavior should not be assumed for Etaoin’s WebDriver call.

Common failures and fixes

Driver not found or session cannot start

  • Symptom: Etaoin cannot create a browser session.
  • Cause: The driver is absent, not on PATH, or incompatible with the installed browser.
  • Fix: Install the matching driver, expose its executable path, and compare browser and driver versions. In CI, print the resolved executable paths before starting the job.

Headless browser exits immediately

  • Symptom: The process starts but no image is written.
  • Cause: Browser startup flags, sandbox restrictions or a crashed browser process.
  • Fix: Reproduce with a visible browser locally, inspect the driver log, and apply only the flags required by your server environment. Do not assume a flag that works in one browser is valid in another.

The image is blank or incomplete

  • Symptom: The PNG exists but content is missing.
  • Cause: Capture occurred before client-side rendering, fonts, images or consent handling completed.
  • Fix: Wait for a meaningful selector or application-ready condition, handle overlays, and verify network-dependent resources from the same machine.

The output path fails

  • Symptom: A file-write or empty-screenshot exception.
  • Cause: The process cannot write the directory, the path resolves somewhere unexpected, or the driver returned no pixels.
  • Fix: Print the absolute path, check permissions and disk space, and use a writable project directory. Etaoin’s API creates missing parent directories, but it cannot overcome a read-only filesystem.

Full-page output is clipped

  • Symptom: Only the initial viewport appears.
  • Cause: The browser’s WebDriver implementation returned a viewport screenshot.
  • Fix: Treat full-page capture as implementation-specific, test another supported browser or use a tool with an explicit full-page option.

Choosing an approach for production

Local Etaoin is a good fit when you need Clojure control, browser interaction, authenticated sessions or a repeatable integration-test environment. It also gives you control over where the browser runs. The trade-off is operational: browsers and drivers must be installed, patched and kept compatible, and each capture consumes local CPU, memory and startup time.

A Clojure wrapper around Playwright, a Chrome DevTools API such as clj-chrome-devtools, Selenium, Playwright or Puppeteer may fit a different requirement. Compare the concrete dimensions that matter to you:

  • Clojure integration and API style
  • Browsers and operating systems you must support
  • Viewport, element and full-page behavior
  • Local versus remote browser management
  • Waiting, authentication, proxy and network controls
  • Operational cost and upgrade responsibility

A hosted service such as Urlbox is another option when you prefer an API-managed browser rather than installing WebDrivers. Evaluate its current capabilities and pricing independently; browser-dependent full-page behavior remains an important question.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo provides a hosted screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP or PDF. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

For Clojure, invoke the HTTP endpoint directly:

(require '[clj-http.client :as http])

(def response
  (http/get "https://api.screenshotneo.com/v1/shot"
            {:query-params {:access_key "YOUR_API_KEY"
                            :url "https://example.com"}
             :as :byte-array
             :socket-timeout 90000
             :connection-timeout 90000}))

(spit "target/example.webp" (:body response) :encoding "ISO-8859-1")

For exact request parameters and output options, see the ScreenshotNeo documentation. The same endpoint can control full-page capture, CSS-selector elements, dark mode, device presets, viewport and retina scale, PDF paper and page ranges, custom CSS or JavaScript, clicks, waits, blocked requests, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, cache TTL, signed image links, asynchronous webhooks and bulk capture of up to 100 URLs per call. It also offers a usage API and OpenAPI specification, and common screenshot-API parameter names work when switching.

Equivalent requests

cURL

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

Python

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://example.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also includes MCP tools named take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

FAQ

Does Etaoin save JPEG or WebP?

The documented e/screenshot and e/screenshot-element calls save PNG files. Convert the image afterward if another format is required.

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

Can I connect Etaoin to a remote browser?

Yes. Etaoin can connect to a remote WebDriver process; configure the endpoint and capabilities for the browser service you operate.

Why does my screenshot differ from my laptop?

Viewport dimensions, device scale, fonts, timezone, logged-in state, browser version and asynchronous data can all differ. Make those inputs explicit in CI and compare the same browser/driver combination.

Frequently Asked Questions

Does Etaoin save JPEG or WebP?

The documented screenshot calls save PNG files; convert afterward if needed.

Can Etaoin connect to a remote browser?

Yes. It can connect to a remote WebDriver process with the appropriate endpoint and capabilities.

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

Why does a headless screenshot differ from my laptop?

Viewport, scale, fonts, timezone, authentication, browser version and asynchronous data may differ; make those inputs explicit.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.