SCI (Small Clojure Interpreter) environment for native-image REPL.
Registers all spel functions as SCI namespaces so they can be evaluated in a native-image compiled REPL without JVM startup.
The SCI context wraps a stateful Playwright session with managed atoms for the Playwright, Browser, BrowserContext, and Page instances.
Namespaces available in --eval mode: spel/ - Simplified API (implicit page/context from atoms) snapshot/ - Accessibility snapshot capture annotate/ - Screenshot annotation input/ - Keyboard, Mouse, Touchscreen (raw pass-throughs) frame/ - Frame and FrameLocator operations (raw pass-throughs) net/ - Network request/response/route (raw pass-throughs) loc/ - Locator operations (raw pass-throughs, explicit Locator arg) assert/ - Assertion functions (raw pass-throughs, explicit assertion obj) core/ - Lifecycle stubs + utility pass-throughs
Usage: (def ctx (create-sci-ctx)) (eval-string ctx "(spel/start!)") (eval-string ctx "(spel/goto "https://example.com")") (eval-string ctx "(spel/snapshot)") (eval-string ctx "(spel/stop!)")
SCI (Small Clojure Interpreter) environment for native-image REPL. Registers all spel functions as SCI namespaces so they can be evaluated in a native-image compiled REPL without JVM startup. The SCI context wraps a stateful Playwright session with managed atoms for the Playwright, Browser, BrowserContext, and Page instances. Namespaces available in --eval mode: spel/ - Simplified API (implicit page/context from atoms) snapshot/ - Accessibility snapshot capture annotate/ - Screenshot annotation input/ - Keyboard, Mouse, Touchscreen (raw pass-throughs) frame/ - Frame and FrameLocator operations (raw pass-throughs) net/ - Network request/response/route (raw pass-throughs) loc/ - Locator operations (raw pass-throughs, explicit Locator arg) assert/ - Assertion functions (raw pass-throughs, explicit assertion obj) core/ - Lifecycle stubs + utility pass-throughs Usage: (def ctx (create-sci-ctx)) (eval-string ctx "(spel/start!)") (eval-string ctx "(spel/goto \"https://example.com\")") (eval-string ctx "(spel/snapshot)") (eval-string ctx "(spel/stop!)")
(create-sci-ctx)Creates a SCI context with all spel functions registered.
The context includes:
pw namespace: All REPL functions (start!, stop!, goto, click, etc.)snapshot namespace: Snapshot capture and ref resolutionannotate namespace: Screenshot annotationinput namespace: Keyboard, Mouse, Touchscreen operationsframe namespace: Frame and FrameLocator operationsnet namespace: Network request/response/route operationsloc namespace: Raw locator operations (explicit Locator arg)assert namespace: Raw assertion operations (explicit assertion obj)core namespace: Lifecycle stubs + utility pass-throughsAll Playwright Java classes are registered for interop.
Returns: SCI context ready for evaluation.
Creates a SCI context with all spel functions registered. The context includes: - `pw` namespace: All REPL functions (start!, stop!, goto, click, etc.) - `snapshot` namespace: Snapshot capture and ref resolution - `annotate` namespace: Screenshot annotation - `input` namespace: Keyboard, Mouse, Touchscreen operations - `frame` namespace: Frame and FrameLocator operations - `net` namespace: Network request/response/route operations - `loc` namespace: Raw locator operations (explicit Locator arg) - `assert` namespace: Raw assertion operations (explicit assertion obj) - `core` namespace: Lifecycle stubs + utility pass-throughs All Playwright Java classes are registered for interop. Returns: SCI context ready for evaluation.
(eval-string ctx code)Evaluates a Clojure string in the SCI context.
Binds SCI's out/err/in to the JVM equivalents so that
println, prn, etc. work correctly in --eval mode.
Params:
ctx - SCI context from create-sci-ctx.
code - String. Clojure code to evaluate.
Returns: Result of evaluation.
Evaluates a Clojure string in the SCI context. Binds SCI's *out*/*err*/*in* to the JVM equivalents so that `println`, `prn`, etc. work correctly in --eval mode. Params: `ctx` - SCI context from create-sci-ctx. `code` - String. Clojure code to evaluate. Returns: Result of evaluation.
(sci-annotate refs)(sci-annotate refs opts)Injects annotation overlays into the current page for visible elements. Takes refs from snapshot and optional display opts.
Injects annotation overlays into the current page for visible elements. Takes refs from snapshot and optional display opts.
(sci-annotated-screenshot refs)(sci-annotated-screenshot refs opts)(sci-assert-attr sel attr-name value)(sci-assert-attr sel attr-name value opts)(sci-assert-contains-class sel class-val)(sci-assert-contains-class sel class-val opts)(sci-assert-contains-text sel expected)(sci-assert-contains-text sel expected opts)(sci-audit-screenshot caption)(sci-audit-screenshot caption opts)Takes a screenshot with a caption bar at the bottom.
Takes a screenshot with a caption bar at the bottom.
(sci-browser)Returns the current Browser instance.
Returns the current Browser instance.
(sci-context)Returns the current BrowserContext instance.
Returns the current BrowserContext instance.
(sci-context-route-from-har! har)(sci-context-route-from-har! har opts)(sci-info)Returns a map with current page :url, :title, :viewport, and :closed? state.
Returns a map with current page :url, :title, :viewport, and :closed? state.
(sci-last-response url)Navigates to URL and returns response info map with :status, :ok?, :url, :headers.
Navigates to URL and returns response info map with :status, :ok?, :url, :headers.
(sci-mark & refs)Highlights specific snapshot refs with prominent pre-action markers. Accepts ref strings with or without @ prefix.
Highlights specific snapshot refs with prominent pre-action markers. Accepts ref strings with or without @ prefix.
(sci-new-tab!)Opens a new tab in the current context and switches to it.
Opens a new tab in the current context and switches to it.
(sci-page)Returns the current Page instance.
Returns the current Page instance.
(sci-report->html entries)(sci-report->html entries opts)Builds a rich HTML report from typed entries. No page needed.
Builds a rich HTML report from typed entries. No page needed.
(sci-report->pdf entries)(sci-report->pdf entries opts)Renders a rich HTML report to PDF via Playwright's page.pdf().
Renders a rich HTML report to PDF via Playwright's page.pdf().
(sci-restart!)(sci-restart! opts)Stops the current session and starts a new one with the given options.
Stops the current session and starts a new one with the given options.
(sci-save-annotated-screenshot! refs path)(sci-save-annotated-screenshot! refs path opts)(sci-save-audit-screenshot! caption path)(sci-save-audit-screenshot! caption path opts)Takes an audit screenshot and saves it to a file.
Takes an audit screenshot and saves it to a file.
(sci-stop!)Stops the Playwright session, closing browser and cleaning up resources.
Stops the Playwright session, closing browser and cleaning up resources.
(sci-switch-tab! idx)Switches to the tab at the given index.
Switches to the tab at the given index.
(sci-tabs)Returns a list of all open tabs with their index, url, title, and active status.
Returns a list of all open tabs with their index, url, title, and active status.
(sci-trace-group name)Opens a named group in the trace. Groups nest actions visually in Trace Viewer.
Opens a named group in the trace. Groups nest actions visually in Trace Viewer.
(sci-trace-group-end)Closes the current trace group.
Closes the current trace group.
(sci-trace-start!)(sci-trace-start! opts)Starts Playwright tracing on the current context.
Opts: :name - String. Trace name (appears in Trace Viewer). :screenshots - Boolean. Capture screenshots (default: false). :snapshots - Boolean. Capture DOM snapshots (default: false). :sources - Boolean. Include source files (default: false).
Starts Playwright tracing on the current context. Opts: :name - String. Trace name (appears in Trace Viewer). :screenshots - Boolean. Capture screenshots (default: false). :snapshots - Boolean. Capture DOM snapshots (default: false). :sources - Boolean. Include source files (default: false).
(sci-trace-stop!)(sci-trace-stop! opts)Stops Playwright tracing and saves to a file.
Opts: :path - String. Output path (default: "trace.zip").
Stops Playwright tracing and saves to a file. Opts: :path - String. Output path (default: "trace.zip").
(sci-unannotate)Removes all annotation overlays from the current page.
Removes all annotation overlays from the current page.
(sci-unmark)Removes all pre-action markers from the current page.
Removes all pre-action markers from the current page.
(sci-wait-for-file-chooser action)(sci-wait-for-file-chooser action opts)(set-default-timeout! ms)Sets the default Playwright action timeout (ms) for new pages. Called from --eval mode when --timeout flag is provided.
Sets the default Playwright action timeout (ms) for new pages. Called from --eval mode when --timeout flag is provided.
(set-throw-on-error! v)When true, Playwright operations throw on error instead of returning anomaly maps. Called from --eval mode so errors short-circuit (do ...) forms.
When true, Playwright operations throw on error instead of returning anomaly maps. Called from --eval mode so errors short-circuit (do ...) forms.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |