Explore and drive a running JavaFX application from its Clojure REPL. Inspect controls, interact with the application, and take screenshots. Useful for people and coding agents with REPL access.
See the latest release on Clojars for dependency coordinates.
Run these forms in your application's REPL. Start with tree to see what's in a window, then use one to find a control and props to inspect it. You can click, type, hover, scroll, and capture the result.
This example assumes one open window. Replace #name and #items with IDs from your application's tree for a text field and a scrollable list.
(require '[cljfx.plorer :as p])
;; Find a window and inspect its contents.
(p/all javafx.stage.Window)
(def window (p/one javafx.stage.Window))
(p/tree window :depth 3 :props [:id :text])
;; Find a field and click its center.
(def field (p/one window "#name"))
(p/mouse-click! window (p/point field 0.5 0.5) :primary)
;; Type "hi!".
(doseq [key [:h :i]]
(p/key-tap! window key))
(p/key-chord! window [:shift :digit1])
;; Inspect the result.
(p/props field :only [:text])
;; Hover over a scrollable list and scroll down.
(def items (p/one window "#items"))
(p/mouse-move! window (p/point items 0.5 0.5))
(p/scroll! window (p/point items 0.5 0.5) 0 -100)
;; Take a screenshot.
(p/screenshot! window)
Can you improve this documentation? These fine people already did:
Vlad Protsenko & vlaaadEdit on GitHub
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 |