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/navigate "https://example.org")") (eval-string ctx "(spel/capture-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/navigate \"https://example.org\")") (eval-string ctx "(spel/capture-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-$ sel-or-loc)(sci-$$ sel)(sci-$alt-text text)(sci-$label text)(sci-$placeholder text)(sci-$ref ref-id)Locates an element by its snapshot ref ID (e.g. "@e2yrjz", "@e9mter").
Locates an element by its snapshot ref ID (e.g. "@e2yrjz", "@e9mter").
(sci-$role role)(sci-$role role opts)(sci-$test-id id)(sci-$text text)(sci-$title-attr text)(sci-add-script-tag opts)(sci-add-style-tag opts)(sci-all-inner-texts sel)(sci-all-text-contents sel)(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-accessible-description sel desc)(sci-assert-accessible-error-message sel msg)(sci-assert-accessible-name sel name-val)(sci-assert-attached sel)(sci-assert-attached sel opts)(sci-assert-attr sel attr-name value)(sci-assert-attr sel attr-name value opts)(sci-assert-checked sel)(sci-assert-checked sel opts)(sci-assert-class sel class-val)(sci-assert-class sel class-val 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-assert-count sel n)(sci-assert-count sel n opts)(sci-assert-css sel css-name value)(sci-assert-css sel css-name value opts)(sci-assert-disabled sel)(sci-assert-disabled sel opts)(sci-assert-editable sel)(sci-assert-editable sel opts)(sci-assert-empty sel)(sci-assert-enabled sel)(sci-assert-enabled sel opts)(sci-assert-focused sel)(sci-assert-focused sel opts)(sci-assert-hidden sel)(sci-assert-hidden sel opts)(sci-assert-id sel id)(sci-assert-id sel id opts)(sci-assert-in-viewport sel)(sci-assert-in-viewport sel opts)(sci-assert-js-property sel prop-name value)(sci-assert-matches-aria-snapshot sel snapshot-str)(sci-assert-not sel)(sci-assert-page-not)(sci-assert-role sel role)(sci-assert-text sel expected)(sci-assert-text sel expected opts)(sci-assert-that target)(sci-assert-title expected)(sci-assert-title expected opts)(sci-assert-url expected)(sci-assert-url expected opts)(sci-assert-value sel value)(sci-assert-value sel value opts)(sci-assert-values sel values)(sci-assert-values sel values opts)(sci-assert-visible sel)(sci-assert-visible sel opts)(sci-attr sel name)(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-back)(sci-bbox sel)(sci-blur sel)(sci-bring-to-front)(sci-browser)Returns the current Browser instance.
Returns the current Browser instance.
(sci-browser-connected?)(sci-browser-version)(sci-check sel)(sci-check sel opts)(sci-checked? sel)(sci-clear sel)(sci-clear-refs!)(sci-click sel)(sci-click sel opts)(sci-context)Returns the current BrowserContext instance.
Returns the current BrowserContext instance.
(sci-context-clear-cookies!)(sci-context-clear-permissions!)(sci-context-cookies)(sci-context-grant-permissions! perms)(sci-context-route-from-har! har)(sci-context-route-from-har! har opts)(sci-context-route-web-socket! pattern handler)(sci-context-save-storage-state! path)(sci-context-set-extra-http-headers! headers)(sci-context-set-offline! offline)(sci-context-storage-state)(sci-count-of sel)(sci-dblclick sel)(sci-dblclick sel opts)(sci-disabled? sel)(sci-dispatch-event sel type)(sci-drag-to sel target-sel)(sci-editable? sel)(sci-emulate-media! opts)(sci-enabled? sel)(sci-eval-js expr)(sci-eval-js expr arg)(sci-evaluate-all-locs sel expr)(sci-evaluate-all-locs sel expr arg)(sci-evaluate-handle expr)(sci-evaluate-handle expr arg)(sci-evaluate-locator sel expr)(sci-evaluate-locator sel expr arg)(sci-expose-binding! binding-name f)(sci-expose-function! fn-name f)(sci-extract-image-results)(sci-extract-news-results)(sci-extract-people-also-ask)(sci-extract-related-searches)(sci-extract-result-stats)(sci-extract-web-results)(sci-fill sel value)(sci-fill sel value opts)(sci-finish-video-recording)(sci-finish-video-recording opts)Stops video recording by closing the context to finalize the video. Returns the video file path. Creates a new context/page without video.
Opts: :save-as - String. Copy video to this path after finalization.
Stops video recording by closing the context to finalize the video. Returns the video file path. Creates a new context/page without video. Opts: :save-as - String. Copy video to this path after finalization.
(sci-first sel)(sci-focus sel)(sci-forward)(sci-frame-by-name name)(sci-frame-by-url pattern)(sci-frames)(sci-full-snapshot)(sci-full-snapshot page)(sci-goto url)(sci-goto url opts)Navigates the current page to a URL. Validates the URL before navigation — throws on invalid URLs.
Navigates the current page to a URL. Validates the URL before navigation — throws on invalid URLs.
(sci-has-next-page?)(sci-help)(sci-help query)Lists all available SCI eval functions with arglists and descriptions. Call with no args to see all namespaces summary. Call with a namespace name to see all functions in that namespace. Call with a search string to find matching functions.
Lists all available SCI eval functions with arglists and descriptions. Call with no args to see all namespaces summary. Call with a namespace name to see all functions in that namespace. Call with a search string to find matching functions.
(sci-hidden? sel)(sci-highlight sel)(sci-hover sel)(sci-hover sel opts)(sci-html)(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-inner-html sel)(sci-inner-text sel)(sci-keyboard)(sci-last sel)(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-launch-chromium _pw & _opts)In daemon mode, returns the daemon's existing browser instance.
In daemon mode, returns the daemon's existing browser instance.
(sci-launch-firefox _pw & _opts)In daemon mode, returns the daemon's existing browser instance.
In daemon mode, returns the daemon's existing browser instance.
(sci-launch-webkit _pw & _opts)In daemon mode, returns the daemon's existing browser instance.
In daemon mode, returns the daemon's existing browser instance.
(sci-loc-filter sel opts)(sci-loc-get-by-label sel text)(sci-loc-get-by-role sel role)(sci-loc-get-by-test-id sel id)(sci-loc-get-by-text sel text)(sci-loc-locator sel sub-sel)(sci-loc-wait-for sel)(sci-loc-wait-for sel opts)(sci-locator-screenshot sel)(sci-locator-screenshot sel opts)(sci-main-frame)(sci-mark & refs)Highlights specific snapshot refs with prominent pre-action markers (e.g. "@e2yrjz").
Highlights specific snapshot refs with prominent pre-action markers (e.g. "@e2yrjz").
(sci-mouse)(sci-new-context _browser & _opts)In daemon mode, returns the daemon's existing browser context.
In daemon mode, returns the daemon's existing browser context.
(sci-new-page _browser)In daemon mode, returns the daemon's existing page.
In daemon mode, returns the daemon's existing page.
(sci-new-page-from-context _ctx)In daemon mode, returns the daemon's existing page.
In daemon mode, returns the daemon's existing page.
(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-nth sel n)(sci-on-close handler)(sci-on-console handler)(sci-on-dialog handler)(sci-on-download handler)(sci-on-page-error handler)(sci-on-popup handler)(sci-on-request handler)(sci-on-response handler)(sci-once-dialog handler)(sci-page)Returns the current Page instance.
Returns the current Page instance.
(sci-page-context)(sci-pdf)(sci-pdf path-or-opts)(sci-press sel key)(sci-press sel key opts)(sci-pw-create)No-op in daemon mode — Playwright instance is managed by the daemon.
No-op in daemon mode — Playwright instance is managed by the daemon.
(sci-reload!)(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-resolve-ref ref-id)Resolves a snapshot ref (e.g. "@e2yrjz") to a Playwright Locator.
Resolves a snapshot ref (e.g. "@e2yrjz") to a Playwright Locator.
(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-route! pattern handler)(sci-route-from-har! har)(sci-route-from-har! har opts)(sci-route-web-socket! pattern handler)(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-screenshot)(sci-screenshot path-or-opts)(sci-scroll)(sci-scroll direction)(sci-scroll direction opts)Scrolls the page or a specific element. direction - :up :down :left :right (default :down) opts map keys: :amount - pixels to scroll (default 500) :smooth? - true for smooth animated scroll (default false) :selector - element ref or CSS selector to scroll within
Scrolls the page or a specific element. direction - :up :down :left :right (default :down) opts map keys: :amount - pixels to scroll (default 500) :smooth? - true for smooth animated scroll (default false) :selector - element ref or CSS selector to scroll within
(sci-scroll-into-view sel)(sci-search! query)(sci-search! query opts)(sci-search-and-collect! query)(sci-search-and-collect! query opts)(sci-search-go-to-page! query page-num)(sci-search-go-to-page! query page-num opts)(sci-search-next-page!)(sci-search-pages query)(sci-search-pages query opts)(sci-search-url query)(sci-search-url query opts)(sci-select sel values)(sci-set-assertion-timeout! ms)(sci-set-content! html)(sci-set-content! html opts)(sci-set-default-navigation-timeout! ms)(sci-set-extra-http-headers! headers)(sci-set-input-files! sel files)(sci-set-page-default-timeout! ms)(sci-set-viewport-size! width height)(sci-sleep ms)(sci-snapshot)(sci-snapshot page-or-opts)(sci-snapshot page opts)(sci-source query)Shows the source code of a SCI eval function. Accepts 'ns/fn' format (e.g. 'spel/click') or bare function name to search.
Shows the source code of a SCI eval function. Accepts 'ns/fn' format (e.g. 'spel/click') or bare function name to search.
(sci-start!)(sci-start! opts)(sci-start-video-recording)(sci-start-video-recording opts)Starts video recording by creating a new context with video recording enabled. Closes the current context/page and creates new ones with video.
Opts: :video-dir - String. Directory for video files (default: "videos"). :video-size - Map with :width :height (default: 1280x720).
Starts video recording by creating a new context with video recording enabled. Closes the current context/page and creates new ones with video. Opts: :video-dir - String. Directory for video files (default: "videos"). :video-size - Map with :width :height (default: 1280x720).
(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-tap sel)(sci-text sel)(sci-thread-sleep ms)Plain JVM thread sleep (ms). Does NOT interact with browser event loop. Prefer page waits (wait-for-selector, wait-for-url, etc.) for browser sync. Use only for non-browser delays (file I/O timing, external process waits).
Plain JVM thread sleep (ms). Does NOT interact with browser event loop. Prefer page waits (wait-for-selector, wait-for-url, etc.) for browser sync. Use only for non-browser delays (file I/O timing, external process waits).
(sci-title)(sci-touchscreen)(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-type-text sel text)(sci-type-text sel text opts)(sci-unannotate)Removes all annotation overlays from the current page.
Removes all annotation overlays from the current page.
(sci-uncheck sel)(sci-uncheck sel opts)(sci-unmark)Removes all pre-action markers from the current page.
Removes all pre-action markers from the current page.
(sci-unroute! pattern)(sci-url)(sci-value sel)(sci-video-path)Returns the video file path for the current page, or nil if not recording.
Returns the video file path for the current page, or nil if not recording.
(sci-viewport-size)Returns the current viewport size of the active page as {:width N :height N}.
Returns the current viewport size of the active page as {:width N :height N}.
(sci-visible? sel)(sci-wait-for sel)(sci-wait-for sel opts)(sci-wait-for-download action)(sci-wait-for-download action opts)(sci-wait-for-file-chooser action)(sci-wait-for-file-chooser action opts)(sci-wait-for-function expr)(sci-wait-for-load)(sci-wait-for-load state)(sci-wait-for-popup action)(sci-wait-for-popup action opts)(sci-wait-for-url url)(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 |