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-browser)Returns the current Browser instance.
Returns the current Browser instance.
(sci-click-ref ref-id)Clicks an element identified by a snapshot ref ID.
Clicks an element identified by a snapshot ref ID.
(sci-context)Returns the current BrowserContext instance.
Returns the current BrowserContext instance.
(sci-fill-ref ref-id value)Fills an input element identified by a snapshot ref ID.
Fills an input element identified by a snapshot ref ID.
(sci-hover-ref ref-id)Hovers over an element identified by a snapshot ref ID.
Hovers over an element identified by a snapshot ref ID.
(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-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-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-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-type-ref ref-id text)Types text into an element identified by a snapshot ref ID.
Types text into an element identified by a snapshot ref ID.
(sci-unannotate)Removes all annotation overlays from the current page.
Removes all annotation overlays 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 |