Liking cljdoc? Tell your friends :D
Clojure only.

etaoin.api

A wrapper over the W3C WebDriver Specification to automate popular browsers.

Tries to normalize differences across the various implementations.

See the User Guide for details and examples.

This is a rich API:

WebDriver

WebDriver Lower Level Comms

Driver Sessions

Querying/Selecting DOM Elements

Browser Navigation

Mouse/Pointer

Inputs/Forms

Cookies

Alerts

Scrolling

Scripting

Browser Windows

Frames

Page Info

Screenshots

Print to PDF

Browser Info

Waiting

Browser Timeouts

WebDriver Actions

Convenience

A wrapper over the [W3C WebDriver Specification](https://www.w3.org/TR/webdriver/) to automate popular browsers.

Tries to normalize differences across the various implementations.

See the [User Guide](/doc/01-user-guide.adoc) for details and examples.

This is a rich API:

**WebDriver**
- [[with-driver]] [[boot-driver]] [[defaults]] [[defaults-global]] [[when-not-drivers]]
- [[with-chrome]] [[with-chrome-headless]] [[chrome]] [[chrome-headless]] [[chrome?]] [[when-chrome]] [[when-not-chrome]]
- [[with-edge]] [[with-edge-headless]] [[edge]] [[edge-headless]] [[when-edge]] [[when-not-edge]]
- [[with-firefox]] [[with-firefox-headless]] [[firefox]] [[firefox-headless]] [[firefox?]] [[when-firefox]] [[when-not-firefox]]
- [[with-safari]] [[safari]] [[safari?]] [[when-safari]] [[when-not-safari]]
- [[driver?]] [[driver-type]] [[running?]] 
- [[headless?]] [[when-headless]] [[when-not-headless]]
- [[disconnect-driver]] [[stop-driver]] [[quit]]

**WebDriver Lower Level Comms**
-  [[execute]] [[with-http-error]]

**Driver Sessions**
- [[get-status]] [[create-session]] [[delete-session]]

**Querying/Selecting DOM Elements**
- [[query]] [[query-all]] [[query-tree]] [[query-from]] [[query-all-from]]
- [[get-active-element]]
- [[query-from-shadow-root]] [[query-from-shadow-root-el]] [[query-all-from-shadow-root]] [[query-all-from-shadow-root-el]]
- [[has-shadow-root?]] [[has-shadow-root-el?]]
- [[exists?]] [[absent?]]
- [[displayed?]] [[displayed-el?]] [[enabled?]] [[enabled-el?]] [[disabled?]] [[invisible?]] [[visible?]]
- [[child]] [[children]]
- [[get-element-tag]] [[get-element-tag-el]]
- [[get-element-attr]] [[get-element-attr-el]] [[get-element-attrs]]
- [[get-element-property]] [[get-element-property-el]] [[get-element-properties]]
- [[has-class?]] [[has-class-el?]] [[has-no-class?]]
- [[get-element-css]] [[get-element-css-el]] [[get-element-csss]]
- [[get-element-shadow-root]] [[get-element-shadow-root-el]]
- [[get-element-text]] [[get-element-text-el]] [[has-text?]]
- [[get-element-inner-html]] [[get-element-inner-html-el]]
- [[get-element-value]] [[get-element-value-el]]
- [[get-element-rect]] [[get-element-rect-el]] [[get-element-size]] [[get-element-size-el]] [[get-element-location]] [[get-element-location-el]] [[get-element-box]] [[intersects?]]
- [[use-css]] [[with-css]] [[use-xpath]] [[with-xpath]]

**Browser Navigation**
- [[go]] [[get-url]] [[get-hash]] [[set-hash]]
- [[back]] [[forward]]
- [[refresh]] [[reload]]

**Mouse/Pointer**
- [[click]] [[click-el]] [[click-single]] [[click-multi]]
- [[left-click-on]] [[middle-click-on]] [[right-click-on]] [[mouse-click-on]]
- [[double-click]] [[double-click-el]]
- [[drag-and-drop]]
- [[touch-tap]]

**Inputs/Forms**
- [[fill]] [[fill-active]] [[fill-el]] [[fill-multi]]
- [[fill-human]] [[fill-human-active]] [[fill-human-el]] [[fill-human-multi]]
- [[select]] [[selected?]] [[selected-el?]]
- [[upload-file]] [[remote-file]]
- [[disabled?]] [[enabled?]]
- [[clear]] [[clear-el]]
- [[submit]]

**Cookies**
- [[get-cookie]] [[get-cookies]]
- [[set-cookie]]
- [[delete-cookie]] [[delete-cookies]]

**Alerts**
- [[has-alert?]] [[has-no-alert?]]
- [[get-alert-text]]
- [[accept-alert]] [[dismiss-alert]]

**Scrolling**
- [[get-scroll]]
- [[scroll]] [[scroll-by]]
- [[scroll-bottom]] [[scroll-top]]
- [[scroll-down]] [[scroll-up]] [[scroll-left]] [[scroll-right]]
- [[scroll-offset]]
- [[scroll-query]]

**Scripting**
- [[js-execute]] [[js-async]] [[js-localstorage-clear]] [[el->ref]] [[add-script]]

**Browser Windows**
- [[get-window-handle]] [[get-window-handles]]
- [[get-window-rect]] [[set-window-rect]]
- [[get-window-position]] [[set-window-position]]
- [[get-window-size]] [[set-window-size]]
- [[maximize]]
- [[switch-window]] [[switch-window-next]]
- [[new-window]] [[close-window]]

**Frames**
- [[switch-frame]] [[switch-frame-first]] [[switch-frame-parent]] [[switch-frame-top]] [[with-frame]]

**Page Info**
- [[get-source]] [[get-title]]

**Screenshots**
- [[screenshot]] [[screenshot-element]] [[with-screenshots]]

**Print to PDF**
- [[print-page]]

**Browser Info**
- [[supports-logs?]] [[get-log-types]] [[get-logs]]
- [[get-user-agent]]
- [[with-postmortem]]

**Waiting**
- [[doto-wait]] [[wait]] [[with-wait]]
- [[*wait-interval*]] [[*wait-timeout*]] [[with-wait-interval]] [[with-wait-timeout]]
- [[wait-exists]] [[wait-absent]]
- [[wait-visible]] [[wait-invisible]]
- [[wait-disabled]] [[wait-enabled]]
- [[wait-has-alert]]
- [[wait-has-class]]
- [[wait-has-text]] [[wait-has-text-everywhere]]
- [[wait-predicate]]
- [[wait-running]]

**Browser Timeouts**
- [[get-timeouts]] [[set-timeouts]]
- [[get-implicit-timeout]] [[set-implicit-timeout]]
- [[get-page-load-timeout]] [[set-page-load-timeout]]
- [[get-script-timeout]] [[set-script-timeout]] [[with-script-timeout]]

**WebDriver Actions**
- [[make-action-input]] [[make-key-input]] [[make-mouse-input]] [[make-pen-input]] [[make-pointer-input]] [[make-touch-input]]
- [[add-action]]
- [[add-double-pause]]
- [[add-key-down]] [[add-key-press]] [[add-key-up]] [[with-key-down]]
- [[add-pause]]
- [[add-pointer-click]] [[add-pointer-click-el]] [[add-pointer-double-click]] [[add-pointer-double-click-el]]
- [[add-pointer-down]] [[add-pointer-up]]
- [[with-pointer-btn-down]] [[with-pointer-left-btn-down]]
- [[add-pointer-move]] [[add-pointer-move-to-el]]
- [[add-pointer-cancel]]
- [[perform-actions]] [[release-actions]]

**Convenience**
- [[rand-uuid]]
raw docstring

*wait-interval*clj

Frequency in seconds to check if we should still wait, default for wait-* functions.

Frequency in seconds to check if we should still wait, default for `wait-*` functions.
sourceraw docstring

*wait-timeout*clj

Maximum seconds to wait, default for wait-* functions.

Maximum seconds to wait, default for `wait-*` functions.
sourceraw docstring

absent?clj

(absent? driver q & more)

Opposite of exists?.

Opposite of [[exists?]].
sourceraw docstring

accept-alertclj

(accept-alert driver)

Have driver accept open alert dialog.

https://www.w3.org/TR/webdriver2/#dfn-accept-alert

Have `driver` accept open alert dialog.

https://www.w3.org/TR/webdriver2/#dfn-accept-alert
sourceraw docstring

add-actionclj

(add-action input action)

Return input with action added.

Return `input` with `action` added.
sourceraw docstring

add-double-pauseclj

(add-double-pause input & [duration])

Return input source with two pause actions added.

Optionally specify a duration, defaults to 0.

Return `input` source with two pause actions added.

Optionally specify a `duration`, defaults to 0.
sourceraw docstring

add-key-downclj

(add-key-down input key)

Return input source with key down action added.

Return `input` source with `key` down action added.
sourceraw docstring

add-key-pressclj

(add-key-press input key)

Return input source with key down and up actions added.

Return `input` source with `key` down and up actions added.
sourceraw docstring

add-key-upclj

(add-key-up input key)

Return input source with key up action added.

Return `input` source with `key` up action added.
sourceraw docstring

add-pauseclj

(add-pause input & [duration])

Return input source with a pause action added.

Optionally specify a duration, defaults to 0.

Return `input` source with a pause action added.

Optionally specify a `duration`, defaults to 0.
sourceraw docstring

add-pointer-cancelclj

(add-pointer-cancel input)

Return input with a pointer cancel action added.

Return `input` with a pointer cancel action added.
sourceraw docstring

add-pointer-clickclj

(add-pointer-click input & [pointer-button])

Return input source with pointer-button down and up actions added.

pointer-button defaults to etaoin.keys/mouse-left

Return `input` source with `pointer-button` down and up actions added.

`pointer-button` defaults to [[etaoin.keys/mouse-left]]
sourceraw docstring

add-pointer-click-elclj

(add-pointer-click-el input el & [pointer-button])

Return input source with pointer-button down and up actions on element el added.

pointer-button defaults to etaoin.keys/mouse-left

Return `input` source with `pointer-button` down and up actions on element `el` added.

`pointer-button` defaults to [[etaoin.keys/mouse-left]]
sourceraw docstring

add-pointer-double-clickclj

(add-pointer-double-click input & [pointer-button])

Return input source with pointer-button down, up, down, up actions added.

pointer-button defaults to etaoin.keys/mouse-left

Return `input` source with `pointer-button` down, up, down, up actions added.

`pointer-button` defaults to [[etaoin.keys/mouse-left]]
sourceraw docstring

add-pointer-double-click-elclj

(add-pointer-double-click-el input el & [pointer-button])

Return input source with pointer-button down, up, down, up actions on element el added.

pointer-button defaults to etaoin.keys/mouse-left

Return `input` source with `pointer-button` down, up, down, up actions on element `el` added.

`pointer-button` defaults to [[etaoin.keys/mouse-left]]
sourceraw docstring

add-pointer-downclj

(add-pointer-down input & [pointer-button])

Return input source with pointer-button down action added.

button defaults to etaoin.keys/mouse-left

Return `input` source with `pointer-button` down action added.

`button` defaults to [[etaoin.keys/mouse-left]]
sourceraw docstring

add-pointer-moveclj

(add-pointer-move input & [{:keys [x y origin duration]}])

Return input source with pointer move action added.

Moves the pointer from origin to offset x y with optional duration in milliseconds.

Possible origin values are:

  • "viewport" move to x y offset in viewport. This is the default.
  • "pointer" x y are interpreted as offsets from the current pointer location.
  • a map that represents a web element for example via el->ref:
    (el->ref (query driver q))
    

    where q is query to find the element.

Optionally specify :duration in milliseconds, defaults to 250.

Return `input` source with pointer move action added.

Moves the pointer from `origin` to offset `x` `y` with optional `duration` in milliseconds.

Possible `origin` values are:
- `"viewport"` move to `x` `y` offset in viewport. This is the default.
- `"pointer"` `x` `y` are interpreted as offsets from the current pointer location.
- a map that represents a web element for example via [[el->ref]]:
    ```Clojure
    (el->ref (query driver q))
    ```
    where `q` is [[query]] to find the element.

Optionally specify `:duration` in milliseconds, defaults to 250.
sourceraw docstring

add-pointer-move-to-elclj

(add-pointer-move-to-el input el & [{:keys [duration]}])

Return input source with pointer move to element el action added.

Optionally specify :duration in milliseconds, defaults to 250.

Return `input` source with pointer move to element `el` action added.

Optionally specify `:duration` in milliseconds, defaults to 250.
sourceraw docstring

add-pointer-upclj

(add-pointer-up input & [pointer-button])

Return input source with pointer-button up action added.

button defaults to etaoin.keys/mouse-left

Return `input` source with `pointer-button` up action added.

`button` defaults to [[etaoin.keys/mouse-left]]
sourceraw docstring

add-scriptclj

(add-script driver url)

Have driver add script with src url to page.

Have `driver` add script with src `url` to page.
sourceraw docstring

backclj

(back driver)

Have driver navigate backward in the browser history.

https://www.w3.org/TR/webdriver2/#dfn-back

Have `driver` navigate backward in the browser history.

https://www.w3.org/TR/webdriver2/#dfn-back
sourceraw docstring

boot-driverclj

(boot-driver type)
(boot-driver type {:keys [host webdriver-url] :as opts})

Launch and return a driver of type (e.g. :chrome, :firefox :safari :edge) with opts options.

  • creates a driver
  • launches a WebDriver process (or connects to an existing running process if :host or :webdriver-url is specified)
  • creates a session for driver

Defaults taken from defaults-global then defaults for type: :port - if :host not specified, port is randomly generated for local WebDriver process :capabilities - are deep merged as part of connect logic.

opts map is optionally, see Driver Options.

Launch and return a driver of `type` (e.g. `:chrome`, `:firefox` `:safari` `:edge`)
with `opts` options.

- creates a driver
- launches a WebDriver process (or connects to an existing running process if `:host`
or `:webdriver-url` is specified)
- creates a session for driver

Defaults taken from [[defaults-global]] then [[defaults]] for `type`:
`:port` - if `:host` not specified, port is randomly generated for local WebDriver process
`:capabilities` - are deep merged as part of connect logic.

`opts` map is optionally, see [Driver Options](/doc/01-user-guide.adoc#driver-options).
sourceraw docstring

childcljdeprecated

(child driver ancestor-el q)

Uses driver to return single element satisfying query q under given ancestor-el element.

See query for details on q.

NOTE: child has been deprecated in favor of query-from which more closely supports query's syntax for q and has a name which better matches its functionality and the latest W3C WebDriver spec.

https://www.w3.org/TR/webdriver2/#dfn-find-element-from-element

Uses `driver` to return single element satisfying query `q` under given `ancestor-el` element.

See [[query]] for details on `q`.

NOTE: `child` has been deprecated in favor of `query-from` which
more closely supports `query`'s syntax for `q` and has a name which
better matches its functionality and the latest W3C WebDriver spec.

https://www.w3.org/TR/webdriver2/#dfn-find-element-from-element
sourceraw docstring

childrencljdeprecated

(children driver ancestor-el q)

Use driver to return a vector of unique elements satisfying query q under given ancestor-el element.

See query for details on q.

NOTE: children has been deprecated in favor of query-all-from which more closely supports query's syntax for q and has a name which better matches its functionality and the latest W3C WebDriver spec.

https://www.w3.org/TR/webdriver2/#find-elements-from-element

Use `driver` to return a vector of unique elements satisfying query `q` under given `ancestor-el` element.

See [[query]] for details on `q`.

NOTE: `children` has been deprecated in favor of `query-all-from` which
more closely supports `query`'s syntax for `q` and has a name which
better matches its functionality and the latest W3C WebDriver spec.

https://www.w3.org/TR/webdriver2/#find-elements-from-element
sourceraw docstring

chromeclj

(chrome)
(chrome opts)

Launch and return a Chrome driver.

opts map is optionally, see Driver Options.

Launch and return a Chrome driver.

`opts` map is optionally, see [Driver Options](/doc/01-user-guide.adoc#driver-options).
sourceraw docstring

chrome-headlessclj

(chrome-headless)
(chrome-headless opt)

Launch and return a headless Chrome driver.

opts map is optionally, see Driver Options.

Launch and return a headless Chrome driver.

`opts` map is optionally, see [Driver Options](/doc/01-user-guide.adoc#driver-options).
sourceraw docstring

chrome?clj

(chrome? driver)

Returns true if a driver is Chrome.

Returns true if a `driver` is Chrome.
sourceraw docstring

clearclj

(clear driver q & more-qs)

Have driver clear input element found by q (and optionally more-qs).

See query for details on q.

Have `driver` clear input element found by `q` (and optionally `more-qs`).

See [[query]] for details on `q`.
sourceraw docstring

clear-elclj

(clear-el driver el)

Have driver clear input element el

https://www.w3.org/TR/webdriver2/#dfn-element-clear

Have `driver` clear input element `el`

https://www.w3.org/TR/webdriver2/#dfn-element-clear
sourceraw docstring

clickclj

(click driver q)

Have driver click on element found by query q.

See query for details on q.

https://www.w3.org/TR/webdriver2/#dfn-element-click

Have `driver` click on element found by query `q`.

See [[query]] for details on `q`.

https://www.w3.org/TR/webdriver2/#dfn-element-click
sourceraw docstring

click-elclj

(click-el driver el)

Have driver click on element el.

Have `driver` click on element `el`.
sourceraw docstring

click-multiclj

(click-multi driver qs & [pause])

Have driver click on first element found by each query in vector qs.

  • qs a vector of queries [query1 query2 query3 ...]
  • pause a pause prior to each click in seconds, default is 0.

See query for details on qs.

Have `driver` click on first element found by each query in vector `qs`.

- `qs`  a vector of queries `[query1 query2 query3 ...]`
- `pause` a pause prior to each click in seconds, default is `0`.

See [[query]] for details on `q`s.
sourceraw docstring

click-singleclj

(click-single driver q)

Have driver click on element found by query q. If q returns more than one element, throws.

See query for details on q.

Have `driver` click on element found by query `q`.
If `q` returns more than one element, throws.

See [[query]] for details on `q`.
sourceraw docstring

click-visibleclj

(click-visible driver q & [opts])

Waits until driver finds visible element via query q then clicks on it.

Waits until `driver` finds visible element via query `q` then clicks on it.

- `opts`: see [[wait-predicate]] opts.
sourceraw docstring

close-windowclj

(close-window driver)

Have driver close current browser window. On last window close, closes the session.

See also: delete-session,quit

https://www.w3.org/TR/webdriver2/#dfn-close-window

Have `driver` close current browser window.
On last window close, closes the session.

See also: [[delete-session]],[[quit]]

https://www.w3.org/TR/webdriver2/#dfn-close-window
sourceraw docstring

create-sessionclj

(create-session driver & [capabilities])

Have driver create a new session and return resulting session-id string.

Opens a browser window as a side-effect (visible if not running headless). Further requests to this driver will be for this session. Etaoin assumes one active session per driver.

https://www.w3.org/TR/webdriver2/#dfn-new-sessions

Have `driver` create a new session and return resulting session-id string.

Opens a browser window as a side-effect (visible if not running headless).
Further requests to this driver will be for this session.
Etaoin assumes one active session per driver.

https://www.w3.org/TR/webdriver2/#dfn-new-sessions
sourceraw docstring

defaultsclj

WebDriver driver type specific option defaults. Note that for locally launched WebDriver processes the default port is a random free port.

WebDriver driver type specific option defaults.
Note that for locally launched WebDriver processes the default port is a random free port.
sourceraw docstring

defaults-globalclj

WebDriver global option defaults

WebDriver global option defaults
sourceraw docstring

(delete-cookie driver cookie-name)

Have driver delete cookie with cookie cookie-name.

https://www.w3.org/TR/webdriver2/#dfn-delete-cookie

Have `driver` delete cookie with cookie `cookie-name`.

https://www.w3.org/TR/webdriver2/#dfn-delete-cookie
sourceraw docstring

delete-cookiescljmultimethod

(delete-cookies driver)

Have driver delete all browser cookies for all domains.

https://www.w3.org/TR/webdriver2/#dfn-delete-all-cookies

Have `driver` delete all browser cookies for all domains.

https://www.w3.org/TR/webdriver2/#dfn-delete-all-cookies
sourceraw docstring

delete-sessionclj

(delete-session driver)

Have driver delete the active session. Closes the browser window.

See also: quit, [[closed-window]].

https://www.w3.org/TR/webdriver2/#dfn-delete-session

Have `driver` delete the active session.
Closes the browser window.

See also: [[quit]], [[closed-window]].

https://www.w3.org/TR/webdriver2/#dfn-delete-session
sourceraw docstring

disabled?clj

(disabled? query q)

Opposite of enabled?

Opposite of [[enabled?]]
sourceraw docstring

disconnect-driverclj

(disconnect-driver driver)

Returns new driver after disconnecting from a running WebDriver process.

Closes the current session that is stored in the driver if it still exists. Removes the session from driver.

Returns new `driver` after disconnecting from a running WebDriver process.

Closes the current session that is stored in the driver if it still exists.
Removes the session from `driver`.
sourceraw docstring

dismiss-alertclj

(dismiss-alert driver)

Have driver cancel open alert dialog.

https://www.w3.org/TR/webdriver2/#dfn-dismiss-alert

Have `driver` cancel open alert dialog.

https://www.w3.org/TR/webdriver2/#dfn-dismiss-alert
sourceraw docstring

displayed-el?cljmultimethod

(displayed-el? driver el)

Return true if driver finds el is displayed/visible.

Displayed-ness is not part of w3c WebDriver spec and is vendor specific. https://www.w3.org/TR/webdriver2/#element-displayedness

See query for details on q.

Note: Safari webdriver has not implemented displayed, for it we currently default to some naive CSS display/visibilty checks.

Return true if `driver` finds `el` is displayed/visible.

Displayed-ness is not part of w3c WebDriver spec and is vendor specific.
https://www.w3.org/TR/webdriver2/#element-displayedness

See [[query]] for details on `q`.

Note: Safari webdriver has not implemented `displayed`, for it
we currently default to some naive CSS display/visibilty checks.
sourceraw docstring

displayed?clj

(displayed? driver q)

Return true if element found by driver with query q is effectively displayed.

Displayed-ness is not part of w3c WebDriver spec and is vendor specific. https://www.w3.org/TR/webdriver2/#element-displayedness

Return true if element found by `driver` with query `q` is effectively displayed.

Displayed-ness is not part of w3c WebDriver spec and is vendor specific.
https://www.w3.org/TR/webdriver2/#element-displayedness
sourceraw docstring

doto-waitcljmacro

(doto-wait seconds obj & body)

The same as clojure.core/doto but prepends each form with (wait seconds) clause.

The same as `clojure.core/doto` but prepends each form with ([[wait]] `seconds`) clause.
sourceraw docstring

double-clickclj

(double-click driver q)

Have driver double-click on element found by query q.

See query for details on q.

Have `driver` double-click on element found by query `q`.

See [[query]] for details on `q`.
sourceraw docstring

double-click-elclj

(double-click-el driver el)

Have driver double-click on element el.

Have `driver` double-click on element `el`.
sourceraw docstring

drag-and-dropclj

(drag-and-drop driver q-from q-to)

Have driver perform a drag and drop from element found by q-from to element found by q-to:

  1. moves mouse pointer to an element found with q-from query;
  2. holds down the mouse button;
  3. moves mouse to an element found with q-to query;
  4. releases the mouse button.

See query for details on q-from, q-to.

Have `driver` perform a drag and drop from element found by `q-from` to element found by `q-to`:

1. moves mouse pointer to an element found with `q-from` query;
2. holds down the mouse button;
3. moves mouse to an element found with `q-to` query;
4. releases the mouse button.

See [[query]] for details on `q-from`, `q-to`.
sourceraw docstring

driver-typeclj

(driver-type driver)

Returns the type of driver (e.g., :chrome, :firefox, :safari, or :edge).

Returns the type of driver (e.g., `:chrome`, `:firefox`, `:safari`, or `:edge`).
sourceraw docstring

driver?clj

(driver? driver type)

Return true if driver is of type (e.g. one of: :chrome, :edge, :firefox, :safari)

Return true if `driver` is of `type` (e.g. one of: `:chrome`, `:edge`, `:firefox`, `:safari`)
sourceraw docstring

edgeclj

(edge)
(edge opts)

Launch and return an Edge driver.

opts map is optionally, see Driver Options.

Launch and return an Edge driver.

`opts` map is optionally, see [Driver Options](/doc/01-user-guide.adoc#driver-options).
sourceraw docstring

edge-headlessclj

(edge-headless)
(edge-headless opts)

Launch and return a headless Edge driver.

opt map is optionally, see Driver Options.

Launch and return a headless Edge driver.

`opt` map is optionally, see [Driver Options](/doc/01-user-guide.adoc#driver-options).
sourceraw docstring

edge?clj

(edge? driver)

Returns true if a driver is Edge.

Returns true if a `driver` is Edge.
sourceraw docstring

el->refclj

(el->ref el)

Return map representing an element reference for WebDriver.

The magic web-element-identifier constant in the source is taken from the WebDriver Spec.

Passing the element reference map to js-execute automatically expands it into a DOM node. For example:

;; returns UUID string for the element
(def el (query driver :button-ok))

;; the first argument will the an Element instance.
(js-execute driver "arguments[0].scrollIntoView()", (el->ref el))
Return map representing an element reference for WebDriver.

The magic `web-element-identifier` constant in the source is 
taken from the [WebDriver Spec](https://www.w3.org/TR/webdriver2/#elements).

Passing the element reference map to `js-execute` automatically
expands it into a DOM node. For example:

```Clojure
;; returns UUID string for the element
(def el (query driver :button-ok))

;; the first argument will the an Element instance.
(js-execute driver "arguments[0].scrollIntoView()", (el->ref el))
```
sourceraw docstring

enabled-el?clj

(enabled-el? driver el)

Return true if driver determines element el is enabled.

For use on form elements.

https://www.w3.org/TR/webdriver2/#dfn-is-element-enabled

Return true if `driver` determines element `el` is enabled.

For use on form elements.

https://www.w3.org/TR/webdriver2/#dfn-is-element-enabled
sourceraw docstring

enabled?clj

(enabled? driver q)

Returns true if driver determines element found by query q is enabled.

See query for details on q.

For use on form elements.

Returns true if `driver` determines element found by query `q` is enabled.

See [[query]] for details on `q`.

For use on form elements.
sourceraw docstring

executeclj

(execute {:keys [driver method path data]})

Return response from having :driver execute HTTP :method request to :path with body :data.

Response body automatically converted from JSON to a clojure keywordized map. Any HTTP status failure code results in a throw.

  • :method HTTP method, e.g. :get, :post, :delete, etc.
  • :path a vector of strings/keywords representing a server's path. For example:
    • this: [:session "aaaa-bbbb-cccc" :element "dddd-eeee" :find]
    • becomes: "/session/aaaa-bbbb-cccc/element/dddd-eeee/find".
  • :data optional body to send. Automatically converted to JSON.

This can be useful to call when you want to invoke some WebDriver implementation specific feature that Etaoin has not otherwise exposed.

For example, if Etaoin did not already have get-url:

(def driver (e/firefox))
(e/go driver "https://clojure.org")
(e/execute {:driver driver
            :method :get
            :path [:session (:session driver) :url]})
;; => {:value "https://clojure.org/"}
Return response from having `:driver` execute HTTP `:method` request to `:path` with body `:data`.

Response body automatically converted from JSON to a clojure keywordized map.
Any HTTP status failure code results in a throw.

- `:method` HTTP method, e.g. `:get`, `:post`, `:delete`, etc.
- `:path` a vector of strings/keywords representing a server's path. For example:
    - this: `[:session "aaaa-bbbb-cccc" :element "dddd-eeee" :find]`
    - becomes: `"/session/aaaa-bbbb-cccc/element/dddd-eeee/find"`.
- `:data` optional body to send. Automatically converted to JSON.

This can be useful to call when you want to invoke some WebDriver
implementation specific feature that Etaoin has not otherwise exposed.

For example, if Etaoin did not already have [[get-url]]:

```Clojure
(def driver (e/firefox))
(e/go driver "https://clojure.org")
(e/execute {:driver driver
            :method :get
            :path [:session (:session driver) :url]})
;; => {:value "https://clojure.org/"}
```
sourceraw docstring

exists?clj

(exists? driver q & more)

Return true if driver can find element via query q.

See query for details on q.

Keep in mind this does not validate whether the found element is visible, clickable and so on.

Return true if `driver` can find element via query `q`.

See [[query]] for details on `q`.

Keep in mind this does not validate whether the found element is visible, clickable and so on.
sourceraw docstring

fillclj

(fill driver q text & more)

Have driver fill input element found by q with text (and optionally more text).

See query for details on q.

Example:

(fill driver :simple-input "foo" "baz" 1)
;; fills the input with text: foobaz1
Have `driver` fill input element found by `q` with `text` (and optionally `more` text).

See [[query]] for details on `q`.

Example:
```Clojure
(fill driver :simple-input "foo" "baz" 1)
;; fills the input with text: foobaz1
```
sourceraw docstring

fill-activeclj

(fill-active driver text & more)

Have driver fill active element with text (and optionally more text).

Have `driver` fill active element with `text` (and optionally `more` text).
sourceraw docstring

fill-elclj

(fill-el driver el text & more)

Have driver fill input element el with text (and optionally more text).

https://www.w3.org/TR/webdriver2/#dfn-element-send-keys

Have `driver` fill input element `el` with `text` (and optionally `more` text).

https://www.w3.org/TR/webdriver2/#dfn-element-send-keys
sourceraw docstring

fill-humanclj

(fill-human driver q text)
(fill-human driver q text opts)

Have driver fill element found by q with text as if it were a real human using opts.

See query for details on q.

See fill-human-el for details on opts.

Have `driver` fill element found by `q` with `text` as if it were a real human using `opts`.

See [[query]] for details on `q`.

See [[fill-human-el]] for details on `opts`.
sourceraw docstring

fill-human-activeclj

(fill-human-active driver text)
(fill-human-active driver text opts)

Fills the currently active element with text as if it were a real human using opts. This is a simple convience function wrapped around get-active-element and fill-human-el.

See fill-human-el for details on opts.

Fills the currently active element with `text` as if it were a real
human using `opts`. This is a simple convience function wrapped
around `get-active-element` and `fill-human-el`.

See [[fill-human-el]] for details on `opts`.
sourceraw docstring

fill-human-elclj

(fill-human-el driver el text opts)

Have driver fill element el with text as if it were a real human using opts.

opts

  • :mistake-prob probability of making a typo (0 to 1.0) (default: 0.1)
  • :pause-max maximum amount of time in seconds to pause between keystrokes (can be fractional) (default: 0.2)
Have `driver` fill element `el` with `text` as if it were a real human using `opts`.

`opts`
- `:mistake-prob` probability of making a typo (0 to 1.0) (default: `0.1`)
- `:pause-max` maximum amount of time in seconds to pause between keystrokes (can be fractional) (default: `0.2`)
sourceraw docstring

fill-human-multiclj

(fill-human-multi driver q-text)
(fill-human-multi driver q-text opts)

Have driver fill multiple elements as if it were a real human being via q-text using opts.

q-text can be:

  • a map of {q1 "text1" q2 "text2" ...}. There are no guarantees about the order in which fields are filled.
  • a vector of [q1 "text1" q2 "text2" ...]. The fields are filled in the order the fields are listed in the vector.

See query for details on qs.

See fill-human-el for details on opts.

Have `driver` fill multiple elements as if it were a real human being via `q-text` using `opts`.

`q-text` can be:
- a map of `{q1 "text1" q2 "text2" ...}`. There are no guarantees 
  about the order in which fields are filled.
- a vector of `[q1 "text1" q2 "text2" ...]`. The fields are filled 
  in the order the fields are listed in the vector.

See [[query]] for details on `q`s.

See [[fill-human-el]] for details on `opts`.
sourceraw docstring

fill-multiclj

(fill-multi driver q-text)

Have driver fill multiple inputs via q-text.

q-text can be:

  • a map of {q1 "text1" q2 "text2" ...}. There are no guarantees about the order in which fields are filled.
  • a vector of [q1 "text1" q2 "text2" ...]. The fields are filled in the order the fields are listed in the vector.

See query for details on qs.

Have `driver` fill multiple inputs via `q-text`.

`q-text` can be:
- a map of `{q1 "text1" q2 "text2" ...}`. There are no guarantees 
  about the order in which fields are filled.
- a vector of `[q1 "text1" q2 "text2" ...]`. The fields are filled 
  in the order the fields are listed in the vector.

See [[query]] for details on `q`s.
sourceraw docstring

firefoxclj

(firefox)
(firefox opts)

Launch and return a Firefox driver.

opts map is optionally, see Driver Options.

Launch and return a Firefox driver.

`opts` map is optionally, see [Driver Options](/doc/01-user-guide.adoc#driver-options).
sourceraw docstring

firefox-headlessclj

(firefox-headless)
(firefox-headless opts)

Launch and return a headless Firefox driver.

opts map is optionally, see Driver Options.

Launch and return a headless Firefox driver.

`opts` map is optionally, see [Driver Options](/doc/01-user-guide.adoc#driver-options).
sourceraw docstring

firefox?clj

(firefox? driver)

Returns true if a driver is Firefox.

Returns true if a `driver` is Firefox.
sourceraw docstring

forwardclj

(forward driver)

Have driver navigate forward in the browser's history.

https://www.w3.org/TR/webdriver2/#dfn-forward

Have `driver` navigate forward in the browser's history.

https://www.w3.org/TR/webdriver2/#dfn-forward
sourceraw docstring

get-active-elementclj

(get-active-element driver)

Have driver return the active element on the page.

An active element is the one with the current focus. It was selected for example by mouse click, a keyboard (tab, arrows), or autofocus.

https://www.w3.org/TR/webdriver2/#dfn-get-active-element

Have `driver` return the active element on the page.

An active element is the one with the current focus.
It was selected for example by mouse click, a keyboard (tab, arrows), or `autofocus`.

https://www.w3.org/TR/webdriver2/#dfn-get-active-element
sourceraw docstring

get-alert-textclj

(get-alert-text driver)

Have driver return text string from alert dialog (if present).

https://www.w3.org/TR/webdriver2/#dfn-get-alert-text

Have `driver` return text string from alert dialog (if present).

https://www.w3.org/TR/webdriver2/#dfn-get-alert-text
sourceraw docstring

(get-cookie driver cookie-name)

Have driver return first cookie matching cookie-name.

When cookie-name is a keyword it will be converted appropriately.

Have `driver` return first cookie matching `cookie-name`.

When `cookie-name` is a keyword it will be converted appropriately.
sourceraw docstring

get-cookiesclj

(get-cookies driver)

Have driver return a vector of current browser cookies.

Each cookie is a map with structure:

{:name "cookie1",
 :value "test1",
 :path "/",
 :domain "",
 :expiry nil,
 :secure false,
 :httpOnly false}

https://www.w3.org/TR/webdriver2/#dfn-get-all-cookies

Have `driver` return a vector of current browser cookies.

Each cookie is a map with structure:

```Clojure
{:name "cookie1",
 :value "test1",
 :path "/",
 :domain "",
 :expiry nil,
 :secure false,
 :httpOnly false}
```

https://www.w3.org/TR/webdriver2/#dfn-get-all-cookies
sourceraw docstring

get-element-attrclj

(get-element-attr driver q attribute)

Have driver return value for attribute of element found by q.

Found attribute value is returned as string. When element is found but attribute is absent, returns nil.

See query for details on q.

Note: there is no special treatment of the class attribute. A single string with spaces is returned.

Example:

(def driver (firefox))
(get-element-attr driver {:tag :a} :class)
;; => "link link__external link__button"
Have `driver` return value for `attribute` of element found by `q`.

Found attribute value is returned as string.
When element is found but attribute is absent, returns `nil`.

See [[query]] for details on `q`.

Note: there is no special treatment of the `class` attribute.
A single string with spaces is returned.

Example:

```Clojure
(def driver (firefox))
(get-element-attr driver {:tag :a} :class)
;; => "link link__external link__button"
```
sourceraw docstring

get-element-attr-elclj

(get-element-attr-el driver el attribute)

Have driver return value for attribute of element el, or nil if attribute does not exist.

https://www.w3.org/TR/webdriver2/#dfn-get-element-attribute

Have `driver` return value for `attribute` of element `el`, or `nil` if attribute does not exist.

https://www.w3.org/TR/webdriver2/#dfn-get-element-attribute
sourceraw docstring

get-element-attrsclj

(get-element-attrs driver q & attributes)

Have driver return values for attributes of element found by query q.

Found attribute values are returned as strings. When element is found but attribute is absent, result is included in vector as nil.

See query for details on q.

Have `driver` return values for `attributes` of element found by query `q`.

Found attribute values are returned as strings.
When element is found but attribute is absent, result is included in vector as `nil`.

See [[query]] for details on `q`.
sourceraw docstring

get-element-boxclj

(get-element-box driver q)

Have driver return map describing a bounding box for element found by query q.

See query for details on q.

The result is a map with the following keys:

  • :x1: top left x coordinate;
  • :y1: top left y coordinate;
  • :x2: bottom right x coordinate;
  • :y2: bottom right y coordinate;
  • :width: width as a difference b/w :x2 and :x1;
  • :height: height as a difference b/w :y2 and :y1.
Have `driver` return map describing a bounding box for element found by query `q`.

See [[query]] for details on `q`.

The result is a map with the following keys:

- `:x1`: top left `x` coordinate;
- `:y1`: top left `y` coordinate;
- `:x2`: bottom right `x` coordinate;
- `:y2`: bottom right `y` coordinate;
- `:width`: width as a difference b/w `:x2` and `:x1`;
- `:height`: height as a difference b/w `:y2` and `:y1`. 
sourceraw docstring

get-element-cssclj

(get-element-css driver q property)

Have driver return the CSS style property of element found by query q.

property is a string/keyword representing a CSS name. Examples: :font or "background-color"

The property will be returned if it was defined for the element itself or inherited.

Found property value is returned as string. When element is found but property is absent, returns nil.

See query for details on q.

Note: colors, fonts and some other properties may be represented differently for different browsers.

Example:

(def driver (firefox))
(e/go driver "https://clojars.org")
(get-element-css driver {:id :content} :background-color)
;; => "rgb(226, 228, 227)"
Have `driver` return the CSS style `property` of element found by query `q`.

`property` is a string/keyword representing a CSS name.
Examples: `:font` or `"background-color"`

The property will be returned if it was defined for the element itself or inherited.

Found property value is returned as string.
When element is found but property is absent, returns `nil`.

See [[query]] for details on `q`.

Note: colors, fonts and some other properties may be represented differently for different browsers.

Example:
```Clojure
(def driver (firefox))
(e/go driver "https://clojars.org")
(get-element-css driver {:id :content} :background-color)
;; => "rgb(226, 228, 227)"
```
sourceraw docstring

get-element-css-elclj

(get-element-css-el driver el property)

Have driver return value for CSS style property of element el, or nil if property does not exist.

https://www.w3.org/TR/webdriver2/#dfn-get-element-css-value

Have `driver` return value for CSS style `property` of element `el`, or `nil` if property does not exist.

https://www.w3.org/TR/webdriver2/#dfn-get-element-css-value
sourceraw docstring

get-element-csssclj

(get-element-csss driver q & properties)

Have driver return CSS style properties matching properties of element found by query q.

See query for details on q.

Found property values are returned as strings. When element is found but property is absent, result is included in vector as nil.

Note: colors, fonts and some other properties may be represented differently for different browsers.

Example:

(def driver (firefox))
(e/go driver "https://clojars.org")
(e/get-element-csss driver {:tag :body} :background-color :typo :line-height :font-size)
;; => ["rgb(226, 228, 227)" nil "20px" "14px"]
Have `driver` return CSS style properties matching `properties` of element found by query `q`.

See [[query]] for details on `q`.

Found property values are returned as strings.
When element is found but property is absent, result is included in vector as `nil`.

Note: colors, fonts and some other properties may be represented differently for different browsers.

Example:
```Clojure
(def driver (firefox))
(e/go driver "https://clojars.org")
(e/get-element-csss driver {:tag :body} :background-color :typo :line-height :font-size)
;; => ["rgb(226, 228, 227)" nil "20px" "14px"]
```
sourceraw docstring

get-element-inner-htmlclj

(get-element-inner-html driver q)

Have driver return inner text of element found by query q.

See query for details on q.

For element with my-id in <div id="my-id"><p class="foo">hello</p></div> return will be "<p class="foo">hello</p>".

See also: get-element-property

Have `driver` return inner text of element found by query `q`.

See [[query]] for details on `q`.

For element with `my-id` in `<div id="my-id"><p class="foo">hello</p></div>` return will be
`"<p class="foo">hello</p>"`.

See also: [[get-element-property]]
sourceraw docstring

get-element-inner-html-elclj

(get-element-inner-html-el driver el)

Have driver return inner text of element el.

For element with my-id in <div id="my-id"><p class="foo">hello</p></div> return will be "<p class="foo">hello</p>".

See also: get-element-property-el

Have `driver` return inner text of element `el`.

For element with `my-id` in `<div id="my-id"><p class="foo">hello</p></div>` return will be
`"<p class="foo">hello</p>"`.

See also: [[get-element-property-el]]
sourceraw docstring

get-element-locationclj

(get-element-location driver q)

Have driver return map of :x :y offset, in pixels of element found by query q.

See query for details on q.

Consider also: get-element-rect

Have `driver` return map of `:x` `:y` offset, in pixels of element found by query `q`.

See [[query]] for details on `q`.

Consider also: [[get-element-rect]]
sourceraw docstring

get-element-location-elclj

(get-element-location-el driver el)

Have driver return map of :x :y offset, in pixels of element el.

Consider also: get-element-rect-el

Have `driver` return map of `:x` `:y` offset, in pixels of element `el`.

Consider also: [[get-element-rect-el]]
sourceraw docstring

get-element-propertiesclj

(get-element-properties driver q & properties)

Have driver return a vector of property values matching properties of element found by query q.

Found property values are returned as strings. When element is found but property is absent, result is included in vector as nil.

See also: get-element-property

See query for details on q.

Have `driver` return a vector of property values matching `properties` of element found by query `q`.

Found property values are returned as strings.
When element is found but property is absent, result is included in vector as `nil`.

See also: [[get-element-property]]

See [[query]] for details on `q`.
sourceraw docstring

get-element-propertyclj

(get-element-property driver q property)

Have driver value for property of element found by query q.

-property examples: :innerHTML, :outerHTML, etc

Found property value is returned as string. When element is found but property is absent, returns nil.

See query for details on q.

Have `driver` value for  `property` of element found by query `q`.

-`property` examples: `:innerHTML`, `:outerHTML`, etc

Found property value is returned as string.
When element is found but property is absent, returns `nil`.

See [[query]] for details on `q`. 
sourceraw docstring

get-element-property-elclj

(get-element-property-el driver el property)

Have driver return value for property of element el.

-property examples: :innerHTML, :outerHTML, etc

https://www.w3.org/TR/webdriver2/#dfn-get-element-property

Have `driver` return value for `property` of element `el`.

-`property` examples: `:innerHTML`, `:outerHTML`, etc

https://www.w3.org/TR/webdriver2/#dfn-get-element-property
sourceraw docstring

get-element-rectclj

(get-element-rect driver q)

Have driver return map of :width, :height, :x and :y, in pixels, of element found by query q.

See query for details on q.

Have `driver` return map of `:width`, `:height`, `:x` and `:y`, in pixels, of element found by query `q`.

See [[query]] for details on `q`.
sourceraw docstring

get-element-rect-elclj

(get-element-rect-el driver el)

Have driver return map of :width, :height, :x and :y, in pixels, of element el.

https://www.w3.org/TR/webdriver2/#dfn-get-element-rect

Have `driver` return map of `:width`, `:height`, `:x` and `:y`, in pixels, of element `el`.

https://www.w3.org/TR/webdriver2/#dfn-get-element-rect
sourceraw docstring

get-element-shadow-rootclj

(get-element-shadow-root driver q)

Returns the shadow root for the first element matching the query, or nil if the element does not have a shadow root.

See query for more details on q.

Returns the shadow root for the first element matching the query, or
`nil` if the element does not have a shadow root.

See [[query]] for more details on `q`.
sourceraw docstring

get-element-shadow-root-elclj

(get-element-shadow-root-el driver el)

Returns the shadow root for the specified element or nil if the element does not have a shadow root.

Returns the shadow root for the specified element or `nil` if the
element does not have a shadow root.
sourceraw docstring

get-element-sizeclj

(get-element-size driver q)

Have driver return map of :width and :height, in pixels, of element found by query q.

See query for details on q.

Consider also: get-element-rect

Have `driver` return map of `:width` and `:height`, in pixels, of element found by query `q`.

See [[query]] for details on `q`.

Consider also: [[get-element-rect]]
sourceraw docstring

get-element-size-elclj

(get-element-size-el driver el)

Have driver return map of :width and :height, in pixels, of element el.

Consider also: get-element-rect-el

Have `driver` return map of `:width` and `:height`, in pixels, of element `el`.

Consider also: [[get-element-rect-el]]
sourceraw docstring

get-element-tagclj

(get-element-tag driver q)

Have driver return tag name of element found by query q.

See query for details on q.

Have `driver` return tag name of element found by query `q`.

See [[query]] for details on `q`.
sourceraw docstring

get-element-tag-elclj

(get-element-tag-el driver el)

Have driver return tag name of element el.

https://www.w3.org/TR/webdriver2/#dfn-get-element-tag-name

Have `driver` return tag name of element `el`.

https://www.w3.org/TR/webdriver2/#dfn-get-element-tag-name
sourceraw docstring

get-element-textclj

(get-element-text driver q)

Have driver return inner text of element found by query q.

See query for details on q.

Text return for <p class="foo">hello</p> is "hello".

Have `driver` return inner text of element found by query `q`.

See [[query]] for details on `q`.

Text return for `<p class="foo">hello</p>` is  `"hello"`.
sourceraw docstring

get-element-text-elclj

(get-element-text-el driver el)

Have driver return text of element el.

Text return for <p class="foo">hello</p> is "hello".

https://www.w3.org/TR/webdriver2/#dfn-get-element-text

Have `driver` return text of element `el`.

Text return for `<p class="foo">hello</p>` is  `"hello"`.

https://www.w3.org/TR/webdriver2/#dfn-get-element-text
sourceraw docstring

get-element-valueclj

(get-element-value driver q)

Have driver return the value of element found by query q.

To be used on input elements.

See query for details on q.

Have `driver` return the value of element found by query `q`.

To be used on input elements.

See [[query]] for details on `q`.
sourceraw docstring

get-element-value-elclj

(get-element-value-el driver el)

Have driver return the value of element el.

To be used on input elements.

Have `driver` return the value of element `el`.

To be used on input elements.
sourceraw docstring

get-hashclj

(get-hash driver)

Have driver fetch the current hash fragment for the current page (nil when not set).

Example:

(def driver (chrome))
(go driver "https://en.wikipedia.org/wiki/Clojure")
(get-hash driver)
;; => nil
(go driver "https://en.wikipedia.org/wiki/Clojure#Popularity")
(get-hash driver)
;; => "Popularity"

See also: set-hash.

Have `driver` fetch the current hash fragment for the current page (nil when not set).

Example:
```Clojure
(def driver (chrome))
(go driver "https://en.wikipedia.org/wiki/Clojure")
(get-hash driver)
;; => nil
(go driver "https://en.wikipedia.org/wiki/Clojure#Popularity")
(get-hash driver)
;; => "Popularity"
````

See also: [[set-hash]].
sourceraw docstring

get-implicit-timeoutclj

(get-implicit-timeout driver)

Returns driver timeout in seconds for finding elements on the page.

Returns `driver` timeout in `seconds` for finding elements on the page.
sourceraw docstring

get-log-typescljmultimethod

(get-log-types driver)

Have driver return a vector of log types the browser supports.

Chrome/Edge specific extension

Have `driver` return a vector of log types the browser supports.

Chrome/Edge specific extension
sourceraw docstring

get-logsclj

(get-logs driver)
(get-logs driver logtype)

Have driver return Javascript console log entries.

Each log entry is a map with the following structure:

{:level :warning,
 :message "1,2,3,4  anonymous (:1)",
 :timestamp 1511449388366,
 :source nil,
 :datetime #inst "2017-11-23T15:03:08.366-00:00"}

Supported by Chrome only:

  • Returns all recorded logs.
  • Clears the logs once they have been read.
  • JS console logs have :console-api for :source field.
  • Entries about errors will have SEVERE level.

Chrome/Edge specific extension.

Have `driver` return Javascript console log entries.

Each log entry is a map with the following structure:
```Clojure
{:level :warning,
 :message "1,2,3,4  anonymous (:1)",
 :timestamp 1511449388366,
 :source nil,
 :datetime #inst "2017-11-23T15:03:08.366-00:00"}
```

Supported by Chrome only:

- Returns all recorded logs.
- Clears the logs once they have been read.
- JS console logs have `:console-api` for `:source` field.
- Entries about errors will have SEVERE level.

Chrome/Edge specific extension.
sourceraw docstring

get-page-load-timeoutclj

(get-page-load-timeout driver)

Returns driver timeout in seconds for loading a page.

Returns `driver` timeout in `seconds` for loading a page.
sourceraw docstring

get-script-timeoutclj

(get-script-timeout driver)

Returns driver timeout in seconds for executing JavaScript.

Returns `driver` timeout in `seconds` for executing JavaScript.
sourceraw docstring

get-scrollclj

(get-scroll driver)

Have driver return the current scroll position as a map of :x :y.

Have `driver` return the current scroll position as a map of `:x` `:y`.
sourceraw docstring

get-sourceclj

(get-source driver)

Have driver return browser's current page HTML markup as a string.

https://www.w3.org/TR/webdriver2/#dfn-get-page-source

Have `driver` return browser's current page HTML markup as a string.

https://www.w3.org/TR/webdriver2/#dfn-get-page-source
sourceraw docstring

get-statusclj

(get-status driver)

Returns driver status.

Can indicate readiness to create a new session.

The return varies for different driver implementations.

https://www.w3.org/TR/webdriver2/#dfn-status

Returns `driver` status.

Can indicate readiness to create a new session.

The return varies for different driver implementations.

https://www.w3.org/TR/webdriver2/#dfn-status
sourceraw docstring

get-timeoutsclj

(get-timeouts driver)

Get millisecond timeouts for :script :pageLoad implicit.

https://www.w3.org/TR/webdriver2/#dfn-get-timeouts

Get `millisecond` timeouts for `:script` `:pageLoad` `implicit`.

https://www.w3.org/TR/webdriver2/#dfn-get-timeouts
sourceraw docstring

get-titleclj

(get-title driver)

Have driver return the current page title.

https://www.w3.org/TR/webdriver2/#dfn-get-title

Have `driver` return the current page title.

https://www.w3.org/TR/webdriver2/#dfn-get-title
sourceraw docstring

get-urlclj

(get-url driver)

Have driver return the current url location as a string.

https://www.w3.org/TR/webdriver2/#dfn-get-current-url

Have `driver` return the current url location as a string.

https://www.w3.org/TR/webdriver2/#dfn-get-current-url
sourceraw docstring

get-user-agentclj

(get-user-agent driver)

Have driver return the browser User-Agent

Have `driver` return the browser `User-Agent`
sourceraw docstring

get-window-handleclj

(get-window-handle driver)

Have driver return the current browser window handle string.

https://www.w3.org/TR/webdriver2/#dfn-get-window-handle

Have `driver` return the current browser window handle string.

https://www.w3.org/TR/webdriver2/#dfn-get-window-handle
sourceraw docstring

get-window-handlesclj

(get-window-handles driver)

Have driver return a vector of all browser window handle strings.

https://www.w3.org/TR/webdriver2/#dfn-get-window-handles

Have `driver` return a vector of all browser window handle strings.

https://www.w3.org/TR/webdriver2/#dfn-get-window-handles
sourceraw docstring

get-window-positionclj

(get-window-position driver)

Have driver return the current window position, in pixels relative to the screen, as a map of :x and :y.

Consider also: get-window-rect

Have `driver` return the current window position, in pixels relative to the screen, as a map of
`:x` and `:y`.

Consider also: [[get-window-rect]]
sourceraw docstring

get-window-rectclj

(get-window-rect driver)

Have driver return the current browser window rect as map of :x, :y, :width, :height

https://www.w3.org/TR/webdriver2/#dfn-get-window-rect

Have `driver` return the current browser window rect as map of `:x`, `:y`, `:width`, `:height`

https://www.w3.org/TR/webdriver2/#dfn-get-window-rect
sourceraw docstring

get-window-sizeclj

(get-window-size driver)

Have driver return the current browser window size in pixels as a map of :width and :height.

Consider also: get-window-rect

Have `driver` return the current browser window size in pixels as a map of `:width` and `:height`.

Consider also: [[get-window-rect]]
sourceraw docstring

goclj

(go driver url)

Have driver open url in the current browser window.

Example:

(def ff (firefox))
(go ff "http://google.com")

https://www.w3.org/TR/webdriver2/#dfn-navigate-to

Have `driver` open `url` in the current browser window.

Example:

```Clojure
(def ff (firefox))
(go ff "http://google.com")
```

https://www.w3.org/TR/webdriver2/#dfn-navigate-to
sourceraw docstring

has-alert?clj

(has-alert? driver)

Returns true if driver sees an open alert dialog.

Returns true if `driver` sees an open alert dialog.
sourceraw docstring

has-class-el?clj

(has-class-el? driver el class)

Returns true if driver finds that element el includes class in its class attribute.

Returns true if `driver` finds that element `el` includes `class` in its class attribute.
sourceraw docstring

has-class?clj

(has-class? driver q class)

Returns true if driver finds that element found by query q includes class in its class attribute.

See query for details on q.

Returns true if `driver` finds that element found by query `q` includes `class` in its class attribute.

See [[query]] for details on `q`.
sourceraw docstring

has-no-alert?clj

(has-no-alert? driver)

Opposite of has-alert?.

Opposite of [[has-alert?]].
sourceraw docstring

has-no-class?clj

(has-no-class? query q class)

Opposite of has-class?.

Opposite of [[has-class?]].
sourceraw docstring

has-shadow-root-el?clj

(has-shadow-root-el? driver el)

Returns true if the specified element has a shadow root or false otherwise.

Returns `true` if the specified element has a shadow root or `false` otherwise.
sourceraw docstring

has-shadow-root?clj

(has-shadow-root? driver q)

Returns true if the first element matching the query has a shadow root or false otherwise.

Returns `true` if the first element matching the query has a shadow
root or `false` otherwise.
sourceraw docstring

has-text?clj

(has-text? driver text)
(has-text? driver q text)

Return true if driver finds that text appears anywhere on a page.

When q is specified, restricts search inside the element that matches query q. See query for details on q.

Return true if `driver` finds that `text` appears anywhere on a page.

When `q` is specified, restricts search inside the element that matches query `q`.
See [[query]] for details on `q`.
sourceraw docstring

headless?clj

(headless? driver)

Returns true if a driver is in headless mode (without UI window).

Returns true if a `driver` is in headless mode (without UI window).
sourceraw docstring

intersects?clj

(intersects? driver q1 q2)

Return true if bounding boxes found by driver for element found by query q1 intersects element found by query q2.

Compares bounding boxes of found elements.

Return true if bounding boxes found by `driver` for element found by query `q1`
intersects element found by query `q2`.

Compares bounding boxes of found elements.
sourceraw docstring

invisible?clj

(invisible? driver q)

Oppsite of visible?.

Oppsite of  [[visible?]].
sourceraw docstring

js-asyncclj

(js-async driver script & args)

Return result of driver executing JavaScript script with args asynchornously in the browser.

Executes an asynchronous script in the browser and returns the result. An asynchronous script one that typically performs some kind of IO operation, like an AJAX request to the server. You cannot just use the return statement like you do in synchronous scripts.

The driver passes a special handler as the last argument that should be called to return the final result.

Note: calling this function requires the script timeout to be set properly, meaning non-zero positive value. See get-script-timeout, set-script-timeout and with-script-timeout.

  • args: additional arguments for your code. Automatically converted to JSON.

Example of a script:

// the `arguments` would be an array of something like:
// [1, 2, true, ..., <special callback added by driver>]

var callback = arguments[arguments.length-1];

// so the main script would look like:
$.ajax({url: '/some/url', success: function(result) {
  if (isResultOk(result)) {
    callback({ok: getProgressData(result)});
  }
  else {
    callback({error: getErrorData(result)});
  }
}});

https://www.w3.org/TR/webdriver2/#dfn-execute-async-script

Return result of `driver` executing JavaScript `script` with `args` asynchornously in the browser.

Executes an asynchronous script in the browser and returns the result.
An asynchronous script one that typically performs some kind of IO operation,
like an AJAX request to the server. You cannot just use the `return` statement
like you do in synchronous scripts.

The driver passes a special handler as the last argument that should be called
to return the final result.

*Note:* calling this function requires the `script` timeout to be set properly,
meaning non-zero positive value. See [[get-script-timeout]], [[set-script-timeout]]
and [[with-script-timeout]].

- `args`: additional arguments for your code. Automatically converted to JSON.

Example of a script:

```Clojure
// the `arguments` would be an array of something like:
// [1, 2, true, ..., <special callback added by driver>]

var callback = arguments[arguments.length-1];

// so the main script would look like:
$.ajax({url: '/some/url', success: function(result) {
  if (isResultOk(result)) {
    callback({ok: getProgressData(result)});
  }
  else {
    callback({error: getErrorData(result)});
  }
}});
```
https://www.w3.org/TR/webdriver2/#dfn-execute-async-script
sourceraw docstring

js-executeclj

(js-execute driver script & args)

Return result of driver executing Javascript script with args synchronously in the browser.

The script is sent as a string (can be multi-line). Under the hood, the browser wraps your code into a function, so avoid using the function clause at the top level.

Don't forget to add return <something> operator if you are interested in a resulting value.

You may access arguments through the built-in arguments pseudo-array from your code. You may pass any data structures that are JSON-compatible (scalars, maps, vectors).

The result value is also returned trough JSON encode/decode pipeline (JS objects turn to Clojure maps, arrays into vectors and so on).

  • args: additional arguments for your script. Automatically converted to JSON.

Example:

(def driver (chrome))
(js-execute driver "return arguments[0] + 1;" 42)
;; => 43

https://www.w3.org/TR/webdriver2/#dfn-execute-script

Return result of `driver` executing Javascript `script` with `args` synchronously in the browser.

The script is sent as a string (can be multi-line). Under the hood,
the browser wraps your code into a function, so avoid using the `function`
clause at the top level.

Don't forget to add `return <something>` operator if you are
interested in a resulting value.

You may access arguments through the built-in `arguments`
pseudo-array from your code. You may pass any data structures that
are JSON-compatible (scalars, maps, vectors).

The result value is also returned trough JSON encode/decode
pipeline (JS objects turn to Clojure maps, arrays into vectors and
so on).

- `args`: additional arguments for your script. Automatically converted to JSON.

Example:
```Clojure
(def driver (chrome))
(js-execute driver "return arguments[0] + 1;" 42)
;; => 43
```
https://www.w3.org/TR/webdriver2/#dfn-execute-script
sourceraw docstring

js-localstorage-clearclj

(js-localstorage-clear driver)

Have driver clear local storage.

Have `driver` clear local storage.
sourceraw docstring

left-click-onclj

(left-click-on driver q)

Have driver move mouse pointer to element found by q then click left mouse button.

See query for details on q.

Have `driver` move mouse pointer to element found by `q` then click left mouse button.

See [[query]] for details on `q`.
sourceraw docstring

make-action-inputclj

(make-action-input type)

Return a new action input source of type.

Return a new action input source of `type`.
sourceraw docstring

make-key-inputclj

(make-key-input)

Return a new action key input source.

Return a new action key input source.
sourceraw docstring

make-mouse-inputclj

(make-mouse-input)

Return a new action mouse input source.

Return a new action mouse input source.
sourceraw docstring

make-pen-inputclj

(make-pen-input)

Return a new action pen input source.

Return a new action pen input source.
sourceraw docstring

make-pointer-inputclj

(make-pointer-input type)

Return a new action pointer input source of pointer type.

Return a new action pointer input source of pointer `type`.
sourceraw docstring

make-touch-inputclj

(make-touch-input)

Return a new action touch input source.

Return a new action touch input source.
sourceraw docstring

maximizeclj

(maximize driver)

Have driver make the current browser window as large as your screen allows.

https://www.w3.org/TR/webdriver2/#dfn-maximize-window

Have `driver` make the current browser window as large as your screen allows.

https://www.w3.org/TR/webdriver2/#dfn-maximize-window
sourceraw docstring

middle-click-onclj

(middle-click-on driver q)

Have driver move mouse pointer to element found by q then click middle mouse button.

See query for details on q.

Useful for opening links in a new tab.

Have `driver` move mouse pointer to element found by `q` then click middle mouse button.

See [[query]] for details on `q`.

Useful for opening links in a new tab.
sourceraw docstring

mouse-click-onclj

(mouse-click-on driver btn q)

Have driver move mouse pointer to element found by q then click mouse-button.

  • mouse-button should be etaoin.keys/mouse-left,etaoin.keys/mouse-middle or etaoin.keys/mouse-right.
  • q see query for details.
Have `driver` move mouse pointer to element found by `q` then click `mouse-button`.

- `mouse-button` should be `etaoin.keys/mouse-left`,`etaoin.keys/mouse-middle` or `etaoin.keys/mouse-right`.
- `q` see [[query]] for details.
sourceraw docstring

new-windowclj

(new-window driver window-type-hint)

Have driver create a new window. The window-type-hint parameter must be either :tab or :window and specifies the type of window that is desired, if supported by the browser. If successful, return a map with keys :handle indicating the new window handle and :type indicating the type of window that was actually created (either :tab or :window).

https://www.w3.org/TR/webdriver2/#dfn-new-window

Have `driver` create a new window. The `window-type-hint` parameter
must be either `:tab` or `:window` and specifies the type of window
that is desired, if supported by the browser. If successful, return
a map with keys `:handle` indicating the new window handle and
`:type` indicating the type of window that was actually
created (either `:tab` or `:window`).

https://www.w3.org/TR/webdriver2/#dfn-new-window
sourceraw docstring

perform-actionsclj

(perform-actions driver input & inputs)

Have driver perform actions defined in input source(s) simultaneously.

See Actions for more details.

https://www.w3.org/TR/webdriver2/#dfn-perform-actions

Have `driver` perform actions defined in `input` source(s) simultaneously.

See [Actions](/doc/01-user-guide.adoc#actions) for more details.

https://www.w3.org/TR/webdriver2/#dfn-perform-actions
sourceraw docstring

(print-page driver file)
(print-page driver file opts)

Have driver print current HTML page to file in PDF format.

file can be either a string or java.io.File, any missing parent directories are automatically created.

opts map is optional:

  • :orientation is :landscape or :portrait (default)
  • :scale a number, defaults to 1, min of 0.1, max of 2
  • :background defaults to false
  • :page (default is North American Letter size 8.5x11 inches)
    • :width in cm, defaults to 21.59
    • :height in cm, defaults to 27.94
  • :margin
    • :top in cm, defaults to1
    • :bottom in cm, defaults to 1
    • :left in cm, defaults to 1
    • :right in cm, default to 1
  • :shrinkToFit defaults to true
  • :pageRanges a vector, 1-based pages to include, example ["1-3" "6"] or [] for all (default)

https://www.w3.org/TR/webdriver2/#dfn-print-page

Have `driver` print current HTML page to `file` in PDF format.

`file` can be either a string or `java.io.File`, any missing parent directories are automatically created.

`opts` map is optional:
- `:orientation` is `:landscape` or `:portrait` (default)
- `:scale` a number, defaults to `1`, min of `0.1`, max of `2`
- `:background` defaults to `false`
- `:page` (default is North American Letter size 8.5x11 inches)
  - `:width` in cm, defaults to `21.59`
  - `:height` in cm, defaults to `27.94`
- `:margin`
  - `:top` in cm, defaults to`1`
  - `:bottom` in cm, defaults to `1`
  - `:left` in cm, defaults to `1`
  - `:right` in cm, default to `1`
- `:shrinkToFit` defaults to `true`
- `:pageRanges` a vector, 1-based pages to include, example `["1-3" "6"]` or `[]` for all (default)

https://www.w3.org/TR/webdriver2/#dfn-print-page
sourceraw docstring

queryclj

(query driver q)
(query driver q & more)

Use driver to find and return the first element on current page matching q.

Query q can be:

  • :active the current active element. Note that this is deprecated. Use get-active-element instead to find the currently active element.
  • a keyword to find element by it's ID attribute:
    • :my-id
    • (use {:id "my-id"} for ids that cannot be represented as keywords)
    • Note that :active conflicts with this usage and therefore you cannot search for a keyword named :active and expect to find an element with ID equal to "active". In this case, use {:id "active"}.
  • a string that contains either an XPath or CSS expression, depending on the driver's locator setting. Defaults to XPath. See use-css, with-css, use-xpath, with-xpath for methods changing the driver's locator setting.
    • XPath: ".//input[@id='uname'][@name='username']"
    • CSS: "input#uname[name='username']"
  • a map with either :xpath or :css:
    • {:xpath ".//input[@id='uname']"}`
    • {:css "input#uname[name='username']"}
  • any other map is converted to an XPath expression:
    • {:tag :div}
    • is equivalent to XPath: ".//div"
  • multiple of the above (wrapped in a vector or not). The result of each search anchors the search for the next, effectively providing a path through the DOM (though you do not have to specify each and every point in the path).
    • {:tag :div} ".//input[@id='uname']"
    • [{:tag :div} ".//input[@id='uname']"] Returns the final element's unique identifier, or throws if any element is not found.

See Selecting Elements for more details.

Makes use of:

Use `driver` to find and return the first element on current page matching `q`.

 Query `q` can be:

 - `:active` the current active element. Note that this is deprecated.
   Use [[get-active-element]] instead to find the currently active element.
 - a keyword to find element by it's ID attribute:
   - `:my-id`
   - (use `{:id "my-id"}` for ids that cannot be represented as keywords)
   - Note that `:active` conflicts with this usage and therefore you
     cannot search for a keyword named `:active` and expect to find an element
     with ID equal to "active". In this case, use `{:id "active"}`.
 - a string that contains either an XPath or CSS expression, depending on the
   driver's locator setting. Defaults to XPath.
   See [[use-css]], [[with-css]], [[use-xpath]], [[with-xpath]] for methods
   changing the driver's locator setting.
   - XPath: `".//input[@id='uname'][@name='username']"`
   - CSS: `"input#uname[name='username']"`
 - a map with either `:xpath` or `:css`:
   - `{:xpath ".//input[@id='uname']"`}`
   - `{:css "input#uname[name='username']"}`
 - any other map is converted to an XPath expression:
   - `{:tag :div}`
   - is equivalent to XPath: `".//div"`
- multiple of the above (wrapped in a vector or not).
  The result of each search anchors the search for the next,
  effectively providing a path through the DOM (though you do not
  have to specify each and every point in the path).
  - `{:tag :div} ".//input[@id='uname']"`
  - `[{:tag :div} ".//input[@id='uname']"]`
  Returns the final element's unique identifier, or throws if any element
  is not found.

See [Selecting Elements](/doc/01-user-guide.adoc#querying) for more details.

Makes use of:
- https://www.w3.org/TR/webdriver2/#dfn-get-active-element
- https://www.w3.org/TR/webdriver2/#dfn-find-element
- https://www.w3.org/TR/webdriver2/#dfn-find-element-from-element
sourceraw docstring

query-allclj

(query-all driver q)
(query-all driver q & more)

Use driver to return a vector of all elements on current page matching q.

See query for details on q.

Makes use of:

Use `driver` to return a vector of all elements on current page matching `q`.

See [[query]] for details on `q`.

Makes use of:
- https://www.w3.org/TR/webdriver2/#dfn-find-elements
- https://www.w3.org/TR/webdriver2/#dfn-find-elements-from-element
sourceraw docstring

query-all-fromclj

(query-all-from driver el q)

Use driver to return a vector of elements satisfying query q, starting the search at the element specified by el. If q is a vector of queries, then the search starts from el and identifies single candidates for the first item in q, and then uses that element as the root of the next search, with the exception of the last item, which is then searched for all matching elements. query-all-from is similar to query-all but starts the search from el rather than the DOM root.

See query for details on q.

https://www.w3.org/TR/webdriver2/#dfn-find-elements-from-element

Use `driver` to return a vector of elements satisfying query `q`,
starting the search at the element specified by `el`. If `q` is a
vector of queries, then the search starts from `el` and identifies
single candidates for the first item in `q`, and then uses that
element as the root of the next search, with the exception of the
last item, which is then searched for all matching
elements. `query-all-from` is similar to `query-all` but starts the
search from `el` rather than the DOM root.

See [[query]] for details on `q`.

https://www.w3.org/TR/webdriver2/#dfn-find-elements-from-element
sourceraw docstring

query-all-from-shadow-rootclj

(query-all-from-shadow-root driver q shadow-q)

First, conducts a standard search (as if by query) for an element with a shadow root. Then, from that shadow root element, conducts a search of the shadow DOM for all elements matching shadow-q.

For details on q, see query.

The shadow-q parameter is similar to the q parameter of the query function, but some drivers may limit it to specific formats (e.g., CSS). See this note for more information. Note that shadow-q does not support query's :active keyword.

First, conducts a standard search (as if by [[query]]) for an element
with a shadow root. Then, from that shadow root element, conducts a
search of the shadow DOM for all elements matching `shadow-q`.

For details on `q`, see [[query]].

The `shadow-q` parameter is similar to the `q` parameter of
the [[query]] function, but some drivers may limit it to specific
formats (e.g., CSS). See [this note](/doc/01-user-guide.adoc#shadow-root-browser-limitations) for more information.
Note that `shadow-q` does not support `query`'s `:active` keyword.
sourceraw docstring

query-all-from-shadow-root-elclj

(query-all-from-shadow-root-el driver shadow-root-el shadow-q)

Queries the shadow DOM rooted at shadow-root-el, looking for all elements specified by shadow-q.

The shadow-q parameter is similar to the q parameter of the query function, but some drivers may limit it to specific formats (e.g., CSS). See this note for more information.

Note that shadow-q does not support query's :active keyword.

https://www.w3.org/TR/webdriver2/#dfn-find-elements-from-shadow-root

Queries the shadow DOM rooted at `shadow-root-el`, looking for all
elements specified by `shadow-q`.

The `shadow-q` parameter is similar to the `q` parameter of
the [[query]] function, but some drivers may limit it to specific
formats (e.g., CSS). See [this note](/doc/01-user-guide.adoc#shadow-root-browser-limitations) for more information.

Note that `shadow-q` does not support `query`'s `:active` keyword.

https://www.w3.org/TR/webdriver2/#dfn-find-elements-from-shadow-root
sourceraw docstring

query-fromclj

(query-from driver el q)

Use driver to return a single element satisfying query q, starting the search at the element specified by el. query-from is similar to query but starts the search from el rather than the DOM root.

See query for details on q.

https://www.w3.org/TR/webdriver2/#dfn-find-element-from-element

Use `driver` to return a single element satisfying query `q`,
starting the search at the element specified by `el`. `query-from`
is similar to `query` but starts the search from `el` rather than
the DOM root.

See [[query]] for details on `q`.

https://www.w3.org/TR/webdriver2/#dfn-find-element-from-element
sourceraw docstring

query-from-shadow-rootclj

(query-from-shadow-root driver q shadow-q)

First, conducts a standard search (as if by query) for an element with a shadow root. Then, from that shadow root element, conducts a search of the shadow DOM for the first element matching shadow-q.

For details on q, see query.

The shadow-q parameter is similar to the q parameter of the query function, but some drivers may limit it to specific formats (e.g., CSS). See this note for more information. Note that shadow-q does not support query's :active keyword.

First, conducts a standard search (as if by [[query]]) for an element
with a shadow root. Then, from that shadow root element, conducts a
search of the shadow DOM for the first element matching `shadow-q`.

For details on `q`, see [[query]].

The `shadow-q` parameter is similar to the `q` parameter of
the [[query]] function, but some drivers may limit it to specific
formats (e.g., CSS). See [this note](/doc/01-user-guide.adoc#shadow-root-browser-limitations) for more information.
Note that `shadow-q` does not support `query`'s `:active` keyword.
sourceraw docstring

query-from-shadow-root-elclj

(query-from-shadow-root-el driver shadow-root-el shadow-q)

Queries the shadow DOM rooted at shadow-root-el, looking for the first element specified by shadow-q.

The shadow-q parameter is similar to the q parameter of the query function, but some drivers may limit it to specific formats (e.g., CSS). See this note for more information.

Note that shadow-q does not support query's :active keyword.

https://www.w3.org/TR/webdriver2/#dfn-find-element-from-shadow-root

Queries the shadow DOM rooted at `shadow-root-el`, looking for the
first element specified by `shadow-q`.

The `shadow-q` parameter is similar to the `q` parameter of
the [[query]] function, but some drivers may limit it to specific
formats (e.g., CSS). See [this note](/doc/01-user-guide.adoc#shadow-root-browser-limitations) for more information.

Note that `shadow-q` does not support `query`'s `:active` keyword.

https://www.w3.org/TR/webdriver2/#dfn-find-element-from-shadow-root
sourceraw docstring

query-treeclj

(query-tree driver q & qs)

Use driver to return a collection of all elements matching piped queries.

The results of q are queried by qs1 which in turn are queried by qs2, and so on.

See query for details on q.

See User Guide for an example.

Makes use of:

Use `driver` to return a collection of all elements matching piped queries.

The results of `q` are queried by `qs1` which in turn are queried by `qs2`, and so on.

See [[query]] for details on `q`.

See [User Guide](/doc/01-user-guide.adoc#query-tree) for an example.

Makes use of:
- https://www.w3.org/TR/webdriver2/#dfn-find-elements
- https://www.w3.org/TR/webdriver2/#dfn-find-elements-from-element
sourceraw docstring

quitclj

(quit driver)

Have driver close the current session, then, if Etaoin launched it, kill the WebDriver process.

Have `driver` close the current session, then, if Etaoin launched it, kill the WebDriver process.
sourceraw docstring

rand-uuidclj

(rand-uuid)

Return a random UUID string.

Return a random UUID string.
sourceraw docstring

refreshclj

(refresh driver)

Have driver reload the content in the current browser window.

https://www.w3.org/TR/webdriver2/#dfn-refresh

Have `driver` reload the content in the current browser window.

https://www.w3.org/TR/webdriver2/#dfn-refresh
sourceraw docstring

release-actionsclj

(release-actions driver)

Have driver clear any active action state. This includes any key presses and/or a pointer button being held down.

https://www.w3.org/TR/webdriver2/#release-actions

Have `driver` clear any active action state.
This includes any key presses and/or a pointer button being held down.

https://www.w3.org/TR/webdriver2/#release-actions
sourceraw docstring

reloadclj

(reload driver)

Alias for refresh

Alias for [[refresh]]
sourceraw docstring

remote-fileclj

(remote-file remote-file-path)

Wraps remote-file-path for use with upload-file to avoid local file existence check.

Example usage:

(upload-file (remote-file "C:/Users/hello/url.txt"))
Wraps `remote-file-path` for use with [[upload-file]] to avoid local file existence check.

Example usage:
```Clojure
(upload-file (remote-file "C:/Users/hello/url.txt"))
```
sourceraw docstring

right-click-onclj

(right-click-on driver q)

Have driver move mouse pointer to element found by q then click right mouse button.

See query for details on q.

Have `driver` move mouse pointer to element found by `q` then click right mouse button.

See [[query]] for details on `q`.
sourceraw docstring

running?clj

(running? driver)

Return true if driver seems accessable via its :host and :port.

Throws

  • if using :webdriver-url
  • if driver process is found not be running
Return true if `driver` seems accessable via its `:host` and `:port`.

Throws
- if using `:webdriver-url`
- if driver process is found not be running
sourceraw docstring

safariclj

(safari)
(safari opts)

Launch and return a Safari driver.

opts map is optionally, see Driver Options.

Launch and return a Safari driver.

`opts` map is optionally, see [Driver Options](/doc/01-user-guide.adoc#driver-options).
sourceraw docstring

safari?clj

(safari? driver)

Returns true if a driver is Safari.

Returns true if a `driver` is Safari.
sourceraw docstring

screenshotclj

(screenshot driver file)

Have driver save a PNG format screenshot of the current page to file. Throws if screenshot is empty.

file can be either a string or java.io.File, any missing parent directories are automatically created.

https://www.w3.org/TR/webdriver2/#dfn-take-screenshot

Have `driver` save a PNG format screenshot of the current page to `file`.
Throws if screenshot is empty.

`file` can be either a string or `java.io.File`, any missing parent directories are automatically created.

https://www.w3.org/TR/webdriver2/#dfn-take-screenshot 
sourceraw docstring

screenshot-elementclj

(screenshot-element driver q file)

Have driver save a PNG format screenshot of the element found by query q to file.

See query for details on q.

file can be either a string or java.io.File, any missing parent directories are automatically created.

https://www.w3.org/TR/webdriver2/#dfn-take-element-screenshot

Have `driver` save a PNG format screenshot of the element found by query `q` to `file`.

See [[query]] for details on `q`.

`file` can be either a string or `java.io.File`, any missing parent directories are automatically created.

https://www.w3.org/TR/webdriver2/#dfn-take-element-screenshot
sourceraw docstring

scrollclj

(scroll driver {:keys [x y]})
(scroll driver x y)

Have driver scroll page to x y absolute pixel coordinates.

Have `driver` scroll page to `x` `y` absolute pixel coordinates.
sourceraw docstring

scroll-bottomclj

(scroll-bottom driver)

Have driver scroll vertically to bottom of the page keeping current horizontal position.

Have `driver` scroll vertically to bottom of the page keeping current horizontal position.
sourceraw docstring

scroll-byclj

(scroll-by driver {:keys [x y]})
(scroll-by driver x y)

Have driver scroll by x y relative pixel offset.

Have `driver` scroll by `x` `y` relative pixel offset.
sourceraw docstring

scroll-downclj

(scroll-down driver)
(scroll-down driver offset)

Have driver scroll the page down by offset pixels.

offset defaults to scroll-offset.

Have `driver` scroll the page down by `offset` pixels.

`offset` defaults to [[scroll-offset]].
sourceraw docstring

scroll-leftclj

(scroll-left driver)
(scroll-left driver offset)

Have driver scroll the page left by offset pixels.

offset defaults to scroll-offset.

Have `driver` scroll the page left by `offset` pixels.

`offset` defaults to [[scroll-offset]].
sourceraw docstring

scroll-offsetclj

Default scroll offset in pixels.

Default scroll offset in pixels.
sourceraw docstring

scroll-queryclj

(scroll-query driver q)
(scroll-query driver q param)

Have driver scroll to the element found by query q.

See query for details on q.

Invokes element's .scrollIntoView() method. Accepts extra param argument that might be either boolean or object for more control. See Mozilla's docs for values.

Have `driver` scroll to the element found by query `q`.

See [[query]] for details on `q`.

Invokes element's `.scrollIntoView()` method. Accepts extra `param`
argument that might be either boolean or object for more control.
See [Mozilla's docs for values](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView).
sourceraw docstring

scroll-rightclj

(scroll-right driver)
(scroll-right driver offset)

Have driver scroll the page right by offset pixels.

offset defaults to scroll-offset.

Have `driver` scroll the page right by `offset` pixels.

`offset` defaults to [[scroll-offset]].
sourceraw docstring

scroll-topclj

(scroll-top driver)

Have driver scroll vertically to the top of the page keeping current horizontal position.

Have `driver` scroll vertically to the top of the page keeping current horizontal position.
sourceraw docstring

scroll-upclj

(scroll-up driver)
(scroll-up driver offset)

Have driver scroll the page up by offset pixels.

offset defaults to scroll-offset.

Have `driver` scroll the page up by `offset` pixels.

`offset` defaults to [[scroll-offset]].
sourceraw docstring

selectclj

(select driver q text)

Convenience function to have driver select first option that includes text for select element found by query q.

To appease a quirk of the Safari WebDriver, we click on the select element first, then the option. Other WebDriver implementations do not seem to need, but are not negatively impacted by, the click on the select element.

See query for details on q.

See User Guide for other ways to select options from dropdowns.

Convenience function to have `driver` select first option that includes `text` for select element found by query `q`.

To appease a quirk of the Safari WebDriver, we click on the select element first, then the option.
Other WebDriver implementations do not seem to need, but are not negatively impacted by, the click on the select element.

See [[query]] for details on `q`.

See [User Guide](/doc/01-user-guide.adoc#select-dropdown) for other ways to select options from dropdowns.
sourceraw docstring

selected-el?clj

(selected-el? driver el)

Return true if driver determines element el is selected.

For use on input elements like checkboxes, radio buttons and option elements.

https://www.w3.org/TR/webdriver2/#dfn-is-element-selected

Return true if `driver` determines element `el` is selected.

For use on input elements like checkboxes, radio buttons and option elements.

https://www.w3.org/TR/webdriver2/#dfn-is-element-selected
sourceraw docstring

selected?clj

(selected? driver q)

Return true if driver determines element found by query q is selected.

See query for details on q.

For use on input elements like checkboxes, radio buttons and option elements.

Return true if `driver` determines element found by query `q` is selected.

See [[query]] for details on `q`.

For use on input elements like checkboxes, radio buttons and option elements.
sourceraw docstring

(set-cookie driver cookie)

Have driver set a cookie.

cookie is a map with structure described in get-cookies. At least :name and :value keys should be populated.

https://www.w3.org/TR/webdriver2/#dfn-adding-a-cookie

Have `driver` set a `cookie`.

`cookie` is a map with structure described in [[get-cookies]].
At least `:name` and `:value` keys should be populated.

https://www.w3.org/TR/webdriver2/#dfn-adding-a-cookie
sourceraw docstring

set-hashclj

(set-hash driver hash)

Have driver set a new hash fragment for the current page.

Don't include the leading # character in hash.

Useful when navigating on single page applications. See also: get-hash.

Have `driver` set a new `hash` fragment for the current page.

Don't include the leading `#` character in `hash`.

Useful when navigating on single page applications. See also: [[get-hash]].
sourceraw docstring

set-implicit-timeoutclj

(set-implicit-timeout driver seconds)

Sets driver timeout seconds for finding elements on the page.

Sets `driver` timeout `seconds` for finding elements on the page.
sourceraw docstring

set-page-load-timeoutclj

(set-page-load-timeout driver seconds)

Sets driver timeout seconds for loading a page.

Sets `driver` timeout `seconds` for loading a page.
sourceraw docstring

set-script-timeoutclj

(set-script-timeout driver seconds)

Sets driver timeout seconds for executing JavaScript.

Sets `driver` timeout `seconds` for executing JavaScript.
sourceraw docstring

set-timeoutsclj

(set-timeouts driver timeouts)

Set millisecond timeouts for any of :script :pageLoad implicit.

Note the capitilization of :pageLoad.

https://www.w3.org/TR/webdriver2/#dfn-set-timeouts

Set `millisecond` timeouts for any of `:script` `:pageLoad` `implicit`.

Note the capitilization of `:pageLoad`.

https://www.w3.org/TR/webdriver2/#dfn-set-timeouts
sourceraw docstring

set-window-positionclj

(set-window-position driver {:keys [x y]})
(set-window-position driver x y)

Have driver set the x y position of the current browser window.

Position is in pixels and relative to your screen. Absolute precision is not guaranteed.

Condiser also: set-window-rect

Have `driver` set the `x` `y` position of the current browser window.

Position is in pixels and relative to your screen.
Absolute precision is not guaranteed.

Condiser also: [[set-window-rect]]
sourceraw docstring

set-window-rectclj

(set-window-rect driver {:keys [width height x y]})

Have driver ase the current browser window :width, :height, :x and/or :y.

https://www.w3.org/TR/webdriver2/#dfn-set-window-rect

Have `driver` ase the current browser window `:width`, `:height`, `:x` and/or `:y`.

https://www.w3.org/TR/webdriver2/#dfn-set-window-rect
sourceraw docstring

set-window-sizeclj

(set-window-size driver {:keys [width height]})
(set-window-size driver width height)

Have driver set the width and height in pixels of the current window. Absolute precision is not guaranteed.

Condiser also: set-window-rect

Have `driver` set the `width` and `height` in pixels of the current window.
Absolute precision is not guaranteed.

Condiser also: [[set-window-rect]]
sourceraw docstring

stop-driverclj

(stop-driver driver)

Returns new driver after killing its WebDriver process.

Returns new `driver` after killing its WebDriver process.
sourceraw docstring

submitclj

(submit driver q)

Have driver submit a form by sending the enter key to input element found by query q.

See query for details on q.

Have `driver` submit a form by sending the enter key to input element found by query `q`.

See [[query]] for details on `q`.
sourceraw docstring

supports-logs?clj

(supports-logs? driver)

Returns true if driver supports getting console logs.

Returns true if `driver` supports getting console logs.
sourceraw docstring

switch-frameclj

(switch-frame driver q)

Have driver switch context to (i)frame element found by query q.

See query for details on q.

https://www.w3.org/TR/webdriver2/#dfn-switch-to-frame

Have `driver` switch context to (i)frame element found by query `q`.

See [[query]] for details on `q`.

https://www.w3.org/TR/webdriver2/#dfn-switch-to-frame
sourceraw docstring

switch-frame-firstclj

(switch-frame-first driver)

Have driver switch context to the first (i)frame.

Have `driver` switch context to the first (i)frame.
sourceraw docstring

switch-frame-parentclj

(switch-frame-parent driver)

Have driver switch context to the parent of the current (i)frame.

https://www.w3.org/TR/webdriver2/#dfn-switch-to-parent-frame

Have `driver` switch context to the parent of the current (i)frame.

https://www.w3.org/TR/webdriver2/#dfn-switch-to-parent-frame
sourceraw docstring

switch-frame-topclj

(switch-frame-top driver)

Have driver switch context the main page.

Have `driver` switch context the main page.
sourceraw docstring

switch-windowclj

(switch-window driver handle)

Have driver switch to browser window with handle.

https://www.w3.org/TR/webdriver2/#dfn-switch-to-window

Have `driver` switch to browser window with `handle`.

https://www.w3.org/TR/webdriver2/#dfn-switch-to-window
sourceraw docstring

switch-window-nextclj

(switch-window-next driver)

A convenience fn to have driver switch to next browser window.

A convenience fn to have `driver` switch to next browser window.
sourceraw docstring

touch-tapclj

(touch-tap driver q)

Have driver touch tap element found by query q.

See query for details on q.

Have `driver` touch tap element found by query `q`.

See [[query]] for details on `q`.
sourceraw docstring

upload-filecljmultimethod

(upload-file driver q path)

Have driver attach a file path to a file input field element found by query q.

Arguments:

  • q see query for details;
  • file
    • when a string or java.io.File object, the file must exist locally.
    • when remote-file file is assumed to exist remotely and no local existence check is performed.

Under the hood, we send the file's name as a sequence of keys to the input.

Have `driver` attach a file `path` to a file input field element found by query `q`.

Arguments:

- `q` see [[query]] for details;
- `file`
  - when a string or java.io.File object, the file must exist locally.
  - when [[remote-file]] file is assumed to exist remotely and no local existence check is performed.

Under the hood, we send the file's name as a sequence of keys to the input.
sourceraw docstring

use-cssclj

(use-css driver)

Return new driver with default locator set to CSS.

Return new `driver` with default locator set to CSS.
sourceraw docstring

use-xpathclj

(use-xpath driver)

Return new driver with default locator set to XPath.

Return new `driver` with default locator set to XPath.
sourceraw docstring

visible?clj

(visible? driver q)

Return true if element found by driver with query q exists and is effectively displayed.

See query for details on q.

Same as displayed? but does not throw if element does not exist.

Return true if element found by `driver` with query `q` exists and is effectively displayed.

See [[query]] for details on `q`.

Same as [[displayed?]] but does not throw if element does not exist.
sourceraw docstring

waitclj

(wait seconds)
(wait driver seconds)

Sleep for seconds.

Sleep for `seconds`.
sourceraw docstring

wait-absentclj

(wait-absent driver q & [opts])

Waits until driver determines element is not found by q (is absent?).

See query for details on q.

Waits until `driver` determines element is not found by `q` (is [[absent?]]).

See [[query]] for details on `q`.

- `opts`: see [[wait-predicate]] opts.
sourceraw docstring

wait-disabledclj

(wait-disabled driver q & [opts])

Waits until driver determines element found by q is disabled?.

See query for details on q.

Waits until `driver` determines element found by `q` is [[disabled?]].

See [[query]] for details on `q`.

- `opts`: see [[wait-predicate]] opts.
sourceraw docstring

wait-enabledclj

(wait-enabled driver q & [opts])

Waits until driver determines element found by q is enabled?.

See query for details on q.

Waits until `driver` determines element found by `q` is [[enabled?]].

See [[query]] for details on `q`.

- `opts`: see [[wait-predicate]] opts.
sourceraw docstring

wait-existsclj

(wait-exists driver q & [opts])

Waits until driver finds element exists? via q.

Waits until `driver` finds element [[exists?]] via `q`.

- `opts`: see [[wait-predicate]] opts.
sourceraw docstring

wait-has-alertclj

(wait-has-alert driver & [opts])

Waits until driver finds page has-alert?.

Waits until `driver` finds page [[has-alert?]].

- `opts`: see [[wait-predicate]] opts.
sourceraw docstring

wait-has-classclj

(wait-has-class driver q class & [opts])

Waits until driver finds element via q has-class? class.

See query for details on q.

Waits until `driver` finds element via `q` [[has-class?]] `class`.

See [[query]] for details on `q`.

- `opts`: see [[wait-predicate]] opts.
sourceraw docstring

wait-has-textclj

(wait-has-text driver q text & [opts])

Waits until driver finds element via q with text anywhere inside it (including inner HTML).

See query for details on q.

Waits until `driver` finds element via `q` with `text` anywhere inside it (including inner HTML).

See [[query]] for details on `q`.

- `opts`: see [[wait-predicate]] opts.
sourceraw docstring

wait-has-text-everywhereclj

(wait-has-text-everywhere driver text & [opts])

Waits until driver finds text anywhere on the current page.

Waits until `driver` finds `text` anywhere on the current page.

- `opts`: see [[wait-predicate]] opts.
sourceraw docstring

wait-invisibleclj

(wait-invisible driver q & [opts])

Waits until driver determines element found by q is invisible?.

See query for details on q.

Waits until `driver` determines element found by `q` is [[invisible?]].

See [[query]] for details on `q`.

- `opts`: see [[wait-predicate]] opts.
sourceraw docstring

wait-predicateclj

(wait-predicate pred)
(wait-predicate pred opts)

Wakes up every :interval seconds to call pred. Keeps this up until either pred returns truthy or :timeout has elapsed. When :timeout has elapsed a slingshot exception is throws with :message.

Arguments:

  • pred: a zero-argument predicate to call
  • opts: a map of optional parameters:
    • :timeout wait limit in seconds, *wait-timeout* by default;
    • :interval how long to wait between calls, *wait-interval* by default;
    • :message a message that becomes a part of exception when timeout is reached.
Wakes up every `:interval` seconds to call `pred`.
Keeps this up until either `pred` returns truthy or `:timeout` has elapsed.
When `:timeout` has elapsed a slingshot exception is throws with `:message`.

Arguments:

- `pred`: a zero-argument predicate to call
- `opts`: a map of optional parameters:
  - `:timeout` wait limit in seconds, [[*wait-timeout*]] by default;
  - `:interval` how long to wait between calls, [[*wait-interval*]] by default;
  - `:message` a message that becomes a part of exception when timeout is reached.
sourceraw docstring

wait-runningclj

(wait-running driver & [opts])

Waits until driver is reachable via its host and port via running?.

Throws

  • if using :webdriver-url.

  • if driver process is found to be no longer running while waiting

  • opts: see wait-predicate opts.

Waits until `driver` is reachable via its host and port via [[running?]].

Throws
- if using `:webdriver-url`.
- if driver process is found to be no longer running while waiting

- `opts`: see [[wait-predicate]] opts.
sourceraw docstring

wait-visibleclj

(wait-visible driver q & [opts])

Waits until driver determines element found by q is visible?.

See query for details on q.

Waits until `driver` determines element found by `q` is [[visible?]].

See [[query]] for details on `q`.

- `opts`: see [[wait-predicate]] opts.
sourceraw docstring

when-chromecljmacro

(when-chrome driver & body)

Executes body when browser driver is Chrome.

Executes `body` when browser `driver` is Chrome.
sourceraw docstring

when-edgecljmacro

(when-edge driver & body)

Executes body when browser driver is Edge.

Executes `body` when browser `driver` is Edge.
sourceraw docstring

when-firefoxcljmacro

(when-firefox driver & body)

Executes body when browser driver is Firefox.

Executes `body` when browser `driver` is Firefox.
sourceraw docstring

when-headlesscljmacro

(when-headless driver & body)

Executes body when the driver is in headless mode.

Executes `body` when the `driver` is in headless mode.
sourceraw docstring

when-not-chromecljmacro

(when-not-chrome driver & body)

Executes body when browser driver is NOT Chrome.

Executes `body` when browser `driver` is NOT Chrome.
sourceraw docstring

when-not-driverscljmacro

(when-not-drivers browsers driver & body)

Executes body when browser driver is NOT in browsers, ex: #{:chrome :safari}

Executes `body` when browser `driver` is NOT in `browsers`, ex: `#{:chrome :safari}`
sourceraw docstring

when-not-edgecljmacro

(when-not-edge driver & body)

Executes body when browser driver is NOT Edge.

Executes `body` when browser `driver` is NOT Edge.
sourceraw docstring

when-not-firefoxcljmacro

(when-not-firefox driver & body)

Executes body when browser driver is NOT Firefox.

Executes `body` when browser `driver` is NOT Firefox.
sourceraw docstring

when-not-headlesscljmacro

(when-not-headless driver & body)

Executes body when browser driver is NOT in headless mode.

Executes `body` when browser `driver` is NOT in headless mode.
sourceraw docstring

when-not-predicatecljmacrodeprecated

(when-not-predicate predicate & body)

Executes body when predicate returns falsy.

Deprecated: Use clojure.core/when-not instead.

Executes `body` when `predicate` returns falsy.

Deprecated: Use `clojure.core/when-not` instead.
sourceraw docstring

when-not-safaricljmacro

(when-not-safari driver & body)

Executes body when browser driver is NOT Safari.

Executes `body` when browser `driver` is NOT Safari.
sourceraw docstring

when-predicatecljmacrodeprecated

(when-predicate predicate & body)

Executes body when predicate returns truthy.

Deprecated: Use clojure.core/when instead.

Executes `body` when `predicate` returns truthy.

Deprecated: Use `clojure.core/when` instead.
sourceraw docstring

when-safaricljmacro

(when-safari driver & body)

Executes body when browser driver is Safari.

Executes `body` when browser `driver` is Safari.
sourceraw docstring

with-chromecljmacro

(with-chrome opts? bind & body)

Executes body with a Chrome driver session bound to bind.

Driver is automatically launched and terminated (even if an exception occurs).

opts map can be omitted, see Driver Options.

Example:

(with-chrome driver
  (go driver "https://clojure.org"))
Executes `body` with a Chrome driver session bound to `bind`.

Driver is automatically launched and terminated (even if an exception occurs).

`opts` map can be omitted, see [Driver Options](/doc/01-user-guide.adoc#driver-options).

Example:

```Clojure
(with-chrome driver
  (go driver "https://clojure.org"))
```
sourceraw docstring

with-chrome-headlesscljmacro

(with-chrome-headless opts? bind & body)

Executes body with a headless Chrome driver session bound to bind.

Driver is automatically launched and terminated (even if an exception occurs).

opts map can be omitted, see Driver Options.

Example:

(with-chrome-headless driver
  (go driver "https://clojure.org"))
Executes `body` with a headless Chrome driver session bound to `bind`.

Driver is automatically launched and terminated (even if an exception occurs).

`opts` map can be omitted, see [Driver Options](/doc/01-user-guide.adoc#driver-options).

Example:

```Clojure
(with-chrome-headless driver
  (go driver "https://clojure.org"))
```
sourceraw docstring

with-csscljmacro

(with-css driver & body)

Execute body with default locator set to CSS.

Execute `body` with default locator set to CSS.
sourceraw docstring

with-drivercljmacro

(with-driver type opts? bind & body)

Executes body with a driver session of type (e.g. :chrome, :firefox :safari :edge) with opts options, binding driver instance to bind.

Driver is automatically launched and terminated (even if an exception occurs).

opts map can be omitted, see Driver Options.

Example:

(with-driver :firefox driver
  (go driver "https://clojure.org"))
Executes `body` with a driver session of `type` (e.g. `:chrome`, `:firefox` `:safari` `:edge`)
with `opts` options, binding driver instance to `bind`.

Driver is automatically launched and terminated (even if an exception occurs).

`opts` map can be omitted, see [Driver Options](/doc/01-user-guide.adoc#driver-options).

Example:

```Clojure
(with-driver :firefox driver
  (go driver "https://clojure.org"))
```
sourceraw docstring

with-edgecljmacro

(with-edge opts? bind & body)

Executes body with an Edge driver session bound to bind.

Driver is automatically launched and terminated (even if an exception occurs).

opts map can be omitted, see Driver Options.

Example:

(with-edge driver
  (go driver "https://clojure.org"))
Executes `body` with an Edge driver session bound to `bind`.

Driver is automatically launched and terminated (even if an exception occurs).

`opts` map can be omitted, see [Driver Options](/doc/01-user-guide.adoc#driver-options).

Example:

```Clojure
(with-edge driver
  (go driver "https://clojure.org"))
```
sourceraw docstring

with-edge-headlesscljmacro

(with-edge-headless opts? bind & body)

Executes body with a headless Edge driver session bound to bind.

Driver is automatically launched and terminated (even if an exception occurs).

opts map can be omitted, see Driver Options.

Example:

(with-edge-headless driver
  (go driver "https://clojure.org"))
Executes `body` with a headless Edge driver session bound to `bind`.

Driver is automatically launched and terminated (even if an exception occurs).

`opts` map can be omitted, see [Driver Options](/doc/01-user-guide.adoc#driver-options).

Example:
```Clojure
(with-edge-headless driver
  (go driver "https://clojure.org"))
```
sourceraw docstring

with-firefoxcljmacro

(with-firefox bind & body)
(with-firefox opts? bind & body)

Executes body with a Firefox driver session bound to bind.

Driver is automatically launched and terminated (even if an exception occurs).

opts map can be omitted, see Driver Options.

Example:

(with-firefox driver
  (go driver "https://clojure.org"))
Executes `body` with a Firefox driver session bound to `bind`.

Driver is automatically launched and terminated (even if an exception occurs).

`opts` map can be omitted, see [Driver Options](/doc/01-user-guide.adoc#driver-options).

Example:

```Clojure
(with-firefox driver
  (go driver "https://clojure.org"))
```
sourceraw docstring

with-firefox-headlesscljmacro

(with-firefox-headless opts? bind & body)

Executes body with a headless Firefox driver session bound to bind.

Driver is automatically launched and terminated (even if an exception occurs).

opts map can be omitted, see Driver Options.

Example:

(with-firefox-headless driver
  (go driver "https://clojure.org"))
Executes `body` with a headless Firefox driver session bound to `bind`.

Driver is automatically launched and terminated (even if an exception occurs).

`opts` map can be omitted, see [Driver Options](/doc/01-user-guide.adoc#driver-options).

Example:

```Clojure
(with-firefox-headless driver
  (go driver "https://clojure.org"))
```
sourceraw docstring

with-framecljmacro

(with-frame driver q & body)

Excecute body within context of frame found via driver by query q.

Frame context is restored after call. Result of body is returned.

Excecute `body` within context of frame found via `driver` by query `q`.

Frame context is restored after call.
Result of `body` is returned.
sourceraw docstring

with-http-errorcljmacro

(with-http-error & body)

Executes body suppressing catching any exception that would normally occur due to HTTP non-success status when communicating with a WebDriver.

Instead returns false on first HTTP non-success status.

Executes `body` suppressing catching any exception that would normally occur due to HTTP non-success status
when communicating with a WebDriver.

Instead returns false on first HTTP non-success status.
sourceraw docstring

with-key-downcljmacro

(with-key-down input key & body)

Returns input source piped through key down, then presumably a body of more actions then a key up action.

Returns `input` source piped through `key` down,
then presumably a `body` of more actions then a `key` up action.
sourceraw docstring

with-pointer-btn-downcljmacro

(with-pointer-btn-down input pointer-button & body)

Returns input source piped through pointer-button down action, then presumably a body of more actions then a pointer pointer-button up action.

pointer-button should be, for example, etaoin.keys/mouse-left

Returns `input` source piped through `pointer-button` down action,
then presumably a `body` of more actions then a pointer `pointer-button` up action.

`pointer-button` should be, for example, [[etaoin.keys/mouse-left]]
sourceraw docstring

with-pointer-left-btn-downcljmacro

(with-pointer-left-btn-down input & body)

Returns input source piped through pointer left button down action, then presumably a body of more actions then a pointer left button up action.

Returns `input` source piped through pointer left button down action,
then presumably a `body` of more actions then a pointer left button up action.
sourceraw docstring

with-postmortemcljmacro

(with-postmortem driver opts & body)

Executes body with postmortem handling. Good for forensics.

If an exception occurs, saves:

  • screenshot .png to :dir-img else :dir else current working directory
  • page source .html to :dir-scr else :dir else current working directory
  • console log .json to :dir-log else :dir else current working directory

Dirs are automatically created if necessary.

:date-format used in filename to keep them unique. See Java SDK SimpleDateFormat for available patterns. Defaults to "yyyy-MM-dd-HH-mm-ss".

Tip: don't bother using with-postmortem in test fixtures. The standard clojure.testframework has its own way of handling exceptions, so wrapping a fixture with (with-postmortem...) would be in vain.

Executes `body` with postmortem handling.
Good for forensics.

If an exception occurs, saves:
- screenshot `.png` to `:dir-img` else `:dir` else current working directory
- page source `.html` to `:dir-scr` else `:dir`  else current working directory
- console log `.json` to `:dir-log` else `:dir` else current working directory

Dirs are automatically created if necessary.

`:date-format` used in filename to keep them unique.
See Java SDK `SimpleDateFormat` for available patterns.
Defaults to `"yyyy-MM-dd-HH-mm-ss"`.

Tip: don't bother using `with-postmortem` in test fixtures.
The standard `clojure.test`framework has its own way of handling exceptions,
so wrapping a fixture with `(with-postmortem...)` would be in vain.
sourceraw docstring

with-safaricljmacro

(with-safari opts? bind & body)

Executes body with a Safari driver session bound to bind.

Driver is automatically launched and terminated (even if an exception occurs).

opts map can be omitted, see Driver Options.

Example:

(with-safari driver
  (go driver "https://clojure.org"))
Executes `body` with a Safari driver session bound to `bind`.

Driver is automatically launched and terminated (even if an exception occurs).

`opts` map can be omitted, see [Driver Options](/doc/01-user-guide.adoc#driver-options).

Example:

```Clojure
(with-safari driver
  (go driver "https://clojure.org"))
```
sourceraw docstring

with-screenshotscljmacro

(with-screenshots driver dir & body)

Have driver save a PNG imge screenshot to dir after each form in body is executed.

Filenames will contain an epoch timestamp.

Have `driver` save a PNG imge screenshot to `dir` after each form in `body` is executed.

Filenames will contain an epoch timestamp.
sourceraw docstring

with-script-timeoutcljmacro

(with-script-timeout driver seconds & body)

Execute body temporarily setting driver to timeout seconds for executing JavaScript. Useful for asynchronous scripts.

Execute `body` temporarily setting `driver` to timeout `seconds` for executing JavaScript.
Useful for asynchronous scripts.
sourceraw docstring

with-waitcljmacro

(with-wait seconds & body)

Execute body waiting seconds before each form.

Returns the value of the last form.

Can be used to perform actions slowly. Some SPA applications need extra time to re-render the content.

Execute `body` waiting `seconds` before each form.

Returns the value of the last form.

Can be used to perform actions slowly. Some SPA applications need extra time
to re-render the content.
sourceraw docstring

with-wait-intervalcljmacro

(with-wait-interval seconds & body)

Execute body with a *wait-interval* of seconds (which can be fractional).

Execute `body` with a [[*wait-interval*]] of `seconds` (which can be fractional).
sourceraw docstring

with-wait-timeoutcljmacro

(with-wait-timeout seconds & body)

Execute body with a *wait-timeout* of seconds

Execute `body` with a [[*wait-timeout*]] of `seconds`
sourceraw docstring

with-xpathcljmacro

(with-xpath driver & body)

Execute body with default locator set to XPath.

Execute `body` with default locator set to XPath.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close