Current browser instance that is used to perform queries
and mutation. This must be set with clojure.core/binding
before anything can be done.
Current browser instance that is used to perform queries and mutation. This **must** be set with `clojure.core/binding` before anything can be done.
Default configuration values that are used by queries and
mutations. You can override these defaults at any point
with the custom config by using clojure.core/binding
. Valid
config options are:
typing-speed
: One of predefined defaults #{:slow :normal :fast :tycitys}
or
custom integer indicating strokes per secondtimeout
: Timeout in millisecond after wait
and mutation macros
stop retrying and bailouttake-screenshot-on-timeout
: Boolean flag indicating whether to try
to take a screenshot if timeout occursscreenshot-dir
: Directory for saved screenshotssnapshot-dir
: Root directory for saved snapshots, see
cuic.test/matches-snapshot?
for more details.abort-on-failed-assertion
: Boolean flag indicating whether or not to
bailout if is*
assertion failsDefault configuration values that are used by queries and mutations. You can override these defaults at any point with the custom config by using `clojure.core/binding`. Valid config options are: * `typing-speed` : One of predefined defaults `#{:slow :normal :fast :tycitys}` or custom integer indicating strokes per second * `timeout` : Timeout in millisecond after `wait` and mutation macros stop retrying and bailout * `take-screenshot-on-timeout` : Boolean flag indicating whether to try to take a screenshot if timeout occurs * `screenshot-dir` : Directory for saved screenshots * `snapshot-dir` : Root directory for saved snapshots, see `cuic.test/matches-snapshot?` for more details. * `abort-on-failed-assertion` : Boolean flag indicating whether or not to bailout if `is*` assertion fails
(active? node)
Returns boolean whether the given node is active (focused) or not
Returns boolean whether the given node is active (focused) or not
(attrs node)
Returns a map of attributes and their values for the given DOM node
Returns a map of attributes and their values for the given DOM node
(checked? node)
Returns boolean whether the given radio button / checkbox is checked or not
Returns boolean whether the given radio button / checkbox is checked or not
(classes node)
Returns a set of CSS classes for the given DOM node
Returns a set of CSS classes for the given DOM node
(clear-text! input-node)
Clears all text from the given input DOM element by selecting all text and pressing backspace. If element is not active, it is activated first by clicking it.
Clears all text from the given input DOM element by selecting all text and pressing backspace. If element is not active, it is activated first by clicking it.
(click! node)
Clicks the given DOM element.
Clicks the given DOM element.
(current-browser)
Returns the current browser instance.
Returns the current browser instance.
(dev-tools)
Escape hatch for underlying Chrome dev tools service
Escape hatch for underlying Chrome dev tools service
(disabled? node)
Returns boolean whether the given input / select / button is disabled or not
Returns boolean whether the given input / select / button is disabled or not
(document)
Returns the root document node or nil if document is not available
Returns the root document node or nil if document is not available
(eval js-code)
Evaluate JavaScript expression in the global JS context. Return value of the expression is converted into Clojure data structure. Supports async expressions (await keyword).
Evaluate JavaScript expression in the global JS context. Return value of the expression is converted into Clojure data structure. Supports async expressions (await keyword).
(focus! node)
Focus on the given DOM element.
Focus on the given DOM element.
(goto! url)
Navigates the page to the given URL.
Navigates the page to the given URL.
(has-class? node class)
Returns boolean whether the given DOM node has the given class or not
Returns boolean whether the given DOM node has the given class or not
(hover! node)
Hover mouse over the given DOM element.
Hover mouse over the given DOM element.
(inner-text node)
Returns the inner text of the given DOM node
Returns the inner text of the given DOM node
(matches? node selector)
Returns boolean whether the given node matches the given CSS selector or not.
Returns boolean whether the given node matches the given CSS selector or not.
(options select-node)
Returns a list of options {:keys [value text selected]} for the given HTML select element.
Returns a list of options {:keys [value text selected]} for the given HTML select element.
(outer-html node)
Returns the outer html of the given node in clojure.data.xml format (node is a map of {:keys [tag attrs content]})
Returns the outer html of the given node in clojure.data.xml format (node is a map of {:keys [tag attrs content]})
(page-screenshot)
Takes a screen capture from the currently visible page and returns a BufferedImage instance containing the screenshot.
Takes a screen capture from the currently visible page and returns a BufferedImage instance containing the screenshot.
(q selector)
(q root-node selector)
Performs a CSS query to the subtree of the given root node and returns a vector of matched nodes. If called without the root node, page document node is used as a root node for the query.
Performs a CSS query to the subtree of the given root node and returns a vector of matched nodes. If called without the root node, page document node is used as a root node for the query.
(rect node)
Returns a bounding client rect for the given node
Returns a bounding client rect for the given node
(run-mutation description mutation)
Helper macro to run wait/retry capable mutation
(run-mutation (my-mutation ...)
(do-something! (dev-tools)))
Helper macro to run wait/retry capable mutation ``` (run-mutation (my-mutation ...) (do-something! (dev-tools))) ```
(run-query [binding expr] & body)
Helper macro to run query/queries to the given node:
(run-query [n (c/q ...)]
(do-something (dev-tools)))
Helper macro to run query/queries to the given node: ``` (run-query [n (c/q ...)] (do-something (dev-tools))) ```
(running-tasks)
Returns a list of currently running browser tasks. Currently only in-flight HTTP requests are supported.
Returns a list of currently running browser tasks. Currently only in-flight HTTP requests are supported.
(screenshot node)
Takes a screen capture from the given DOM node and returns a BufferedImage instance containing the screenshot. DOM node must be visible or otherwise an exception is thrown.
Takes a screen capture from the given DOM node and returns a BufferedImage instance containing the screenshot. DOM node must be visible or otherwise an exception is thrown.
(scroll-to! node)
Scrolls window to the given DOM node if that node is not already visible in the current viewport
Scrolls window to the given DOM node if that node is not already visible in the current viewport
(select! select-node & values)
Selects the given value (or values if multiselect) to the given select node
Selects the given value (or values if multiselect) to the given select node
(select-text! input-node)
Selects all text from the given input DOM element. If element is not active, it is activated first by clicking it.
Selects all text from the given input DOM element. If element is not active, it is activated first by clicking it.
(sleep ms)
Holds the execution the given milliseconds
Holds the execution the given milliseconds
(term-freqs node)
Returns a number of occurrences per term in the given node's inner text
Returns a number of occurrences per term in the given node's inner text
(text-content node)
Returns the raw text content of the given DOM node.
Returns the raw text content of the given DOM node.
(type! input-node & keys)
Types text to the given input element. If element is not active, it is activated first by clicking it.
Types text to the given input element. If element is not active, it is activated first by clicking it.
(upload! input-node & files)
Sets the file(s) to the given input node. All files must instances of
class java.io.File
.
Sets the file(s) to the given input node. All files must instances of class `java.io.File`.
(value input-node)
Returns the current value of the given input element.
Returns the current value of the given input element.
(visible? node)
Returns boolean whether the given DOM node is visible in DOM or not
Returns boolean whether the given DOM node is visible in DOM or not
(wait expr)
Evaluates the given expression and returns the value if it is truthy, otherwise pauses execution for a moment and re-tries to evaluate the expression. Continues this until thruthy value or timeout exception occurs.
Evaluates the given expression and returns the value if it is truthy, otherwise pauses execution for a moment and re-tries to evaluate the expression. Continues this until thruthy value or timeout exception occurs.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close