Liking cljdoc? Tell your friends :D
Clojure only.

etaoin.api

The API below was written regarding to the source code of different Webdriver implementations. All of them partially differ from the official W3C specification.

The standard: https://www.w3.org/TR/webdriver/

Chrome: https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/

Firefox (Geckodriver): https://github.com/mozilla/geckodriver https://github.com/mozilla/webdriver-rust/

Phantom.js (Ghostdriver) https://github.com/detro/ghostdriver/blob/

The API below was written regarding to the source code
of different Webdriver implementations. All of them partially
differ from the official W3C specification.

The standard:
https://www.w3.org/TR/webdriver/

Chrome:
https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/

Firefox (Geckodriver):
https://github.com/mozilla/geckodriver
https://github.com/mozilla/webdriver-rust/

Phantom.js (Ghostdriver)
https://github.com/detro/ghostdriver/blob/
raw docstring

*wait-interval*clj

source

*wait-timeout*clj

source

absent?clj

Opposite of exists?.

Opposite of `exists?`.
sourceraw docstring

accept-alertcljmultimethod

Simulates submitting an alert dialog (pressing OK button).

Simulates submitting an alert dialog (pressing OK button).
sourceraw docstring

add-actionclj

(add-action input action)
source

add-double-pauseclj

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

add-key-downclj

(add-key-down input key)
source

add-key-pressclj

(add-key-press input key)
source

add-key-upclj

(add-key-up input key)
source

add-pauseclj

(add-pause input & [duration])
source

add-pointer-cancelclj

(add-pointer-cancel input)
source

add-pointer-clickclj

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

add-pointer-click-elclj

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

add-pointer-double-clickclj

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

add-pointer-double-click-elclj

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

add-pointer-downclj

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

add-pointer-moveclj

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

Move the pointer from origin to x and y offsets with duration in milliseconds.

Possible origin values are:

  • 'viewport'; the final x axis will be equal to x offset and the final y equal to y offset. This is the default value.

  • 'pointer'; the final x will be equal to start x of pointer + x offset and the final y equal to start y of pointer + y offset.

  • a map that represents a web element. To get it, pass the result of the query function into the el->ref, for example:

(el->ref (query driver q))

where q is a query term to find an element.

Move the pointer from `origin` to `x` and `y` offsets
with `duration` in milliseconds.

Possible `origin` values are:

  - 'viewport'; the final x axis will be equal to `x` offset
  and the final y equal to `y` offset. This is the default
  value.

  - 'pointer'; the final x will be equal to start x of pointer + `x` offset
  and the final y equal to start y of pointer + `y` offset.

  - a map that represents a web element. To get it, pass the result
  of the `query` function into the `el->ref`, for example:

  (el->ref (query driver q))

  where `q` is a query term to find an element.
sourceraw docstring

add-pointer-move-to-elclj

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

add-pointer-upclj

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

add-scriptclj

(add-script driver url)
source

backclj

(back driver)

Move backwards in a browser's history.

Move backwards in a browser's history.
sourceraw docstring

boot-driverclj

(boot-driver type)
(boot-driver type {:keys [host] :as opt})

Three-in-one: creates a driver, starts a process and creates a new session. Returns the driver instance.

Arguments:

  • type a keyword determines a driver type.

  • opt a map of all possible parameters that -create-driver, -run-driver and -connect-driver may accept.

Three-in-one: creates a driver, starts a process and creates a new
session. Returns the driver instance.

Arguments:

- `type` a keyword determines a driver type.

- `opt` a map of all possible parameters that `-create-driver`,
`-run-driver` and `-connect-driver` may accept.
sourceraw docstring

childclj

(child driver ancestor-el q)

Finds a single element under given root element.

Finds a single element under given root element.
sourceraw docstring

childrenclj

(children driver ancestor-el q)

Finds multiple elements under given root element.

Finds multiple elements under given root element.
sourceraw docstring

chromeclj

Launches Chrome driver. A shortcut for boot-driver.

Launches Chrome driver. A shortcut for `boot-driver`.
sourceraw docstring

chrome-headlessclj

(chrome-headless)
(chrome-headless opt)

Launches headless Chrome driver. A shortcut for boot-driver.

Launches headless Chrome driver. A shortcut for `boot-driver`.
sourceraw docstring

chrome?clj

(chrome? driver)

Returns true if a driver is a Chrome instance.

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

clearclj

(clear driver q & more)

Clears an element (input, textarea) found with a query.

0.1.6: multiple queries added.

Clears an element (input, textarea) found with a query.

0.1.6: multiple queries added.
sourceraw docstring

clear-elclj

(clear-el driver el)

Clears an element by its identifier.

Clears an element by its identifier.
sourceraw docstring

clickclj

(click driver q)

Clicks on an element (a link, a button, etc).

Clicks on an element (a link, a button, etc).
sourceraw docstring

click-elclj

(click-el driver el)

Click on an element having its system id.

Click on an element having its system id.
sourceraw docstring

click-multiclj

(click-multi driver qs & [pause])

Clicks on a multiple elements in batch.

qs a vector of [query1 query2 query3 ...] pause a pause between click in seconds, default is 0

Clicks on a multiple elements in batch.

`qs`  a vector of [query1 query2 query3 ...]
`pause` a pause between click in seconds, default is 0
sourceraw docstring

click-singleclj

(click-single driver q)

Click on an element checking that there is only one element found. Throw an exception otherwise.

Click on an element checking that there is only one element found.
Throw an exception otherwise.
sourceraw docstring

click-visibleclj

(click-visible driver q & [opt])

Waits until an element becomes visible, then clicks on it.

Arguments:

  • driver: a driver instance;
  • q: a query term (see query);
  • opt: a map of options (see wait-predicate).
Waits until an element becomes visible, then clicks on it.

Arguments:

- `driver`: a driver instance;
- `q`: a query term (see `query`);
- `opt`: a map of options (see `wait-predicate`).
sourceraw docstring

close-windowcljmultimethod

Closes the current browser window.

Closes the current browser window.
sourceraw docstring

create-sessionclj

(create-session driver & [capabilities])

Initiates a new session for a driver. Opens a browser window as a side-effect. All the further requests are made within specific session. Some drivers may work with only one active session. Returns a long string identifier.

Initiates a new session for a driver. Opens a browser window as a
side-effect. All the further requests are made within specific
session. Some drivers may work with only one active session. Returns
a long string identifier.
sourceraw docstring

default-durationclj

source

default-locatorclj

source

default-originclj

source

defaultsclj

source

(delete-cookie driver cookie-name)

Deletes a cookie by its name.

Deletes a cookie by its name.
sourceraw docstring

delete-cookiescljmultimethod

(delete-cookies driver)

Deletes all the cookies for all domains.

Deletes all the cookies for all domains.
sourceraw docstring

delete-sessionclj

(delete-session driver)

Deletes a session. Closes a browser window.

Deletes a session. Closes a browser window.
sourceraw docstring

disabled?clj

source

disconnect-driverclj

(disconnect-driver driver)

Disconnects from a running Webdriver server.

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

Disconnects from a running Webdriver server.

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

dismiss-alertcljmultimethod

Simulates cancelling an alert dialog (pressing cross button).

Simulates cancelling an alert dialog (pressing cross button).
sourceraw docstring

dispatch-driverclj

(dispatch-driver driver & _)

Returns the current driver's type. Used as dispatcher in multimethods.

Returns the current driver's type. Used as dispatcher in
multimethods.
sourceraw docstring

displayed-el?cljmultimethod

Checks whether an element is displayed by its identifier.

Note: Safari does not have native displayed implementation, we have to check some common cases manually (CSS display, visibility, etc).

Returns true or false.

Checks whether an element is displayed by its identifier.

Note: Safari does not have native `displayed` implementation, we
have to check some common cases manually (CSS display, visibility,
etc).

Returns true or false.
sourceraw docstring

displayed?clj

(displayed? driver q)

Checks whether an element is displayed an screen.

Checks whether an element is displayed an screen.
sourceraw docstring

doto-waitcljmacro

(doto-wait n obj & body)

The same as doto but prepends each form with (wait n) clause.

The same as doto but prepends each form with (wait n) clause.
sourceraw docstring

double-clickclj

(double-click driver q)

Performs double click on an element.

Note:

the supported browsers are Chrome, and Phantom.js. For Firefox and Safari, your may try to simulate it as a click, wait, click sequence.

Performs double click on an element.

Note:

the supported browsers are Chrome, and Phantom.js.
For Firefox and Safari, your may try to simulate it as a `click, wait, click`
sequence.
sourceraw docstring

double-click-elcljmultimethod

source

drag-and-dropcljmultimethod

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

Performs drag and drop operation as a sequence of the following steps:

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

Arguments:

  • driver: a driver instance,

  • q-from: from what element to start dragging; any expression that query function may accept;

  • q-to: to what element to drag, a seach term.

Notes:

  • does not work in Phantom.js since it does not have a virtual mouse API;

  • does not work in Safari.

Performs drag and drop operation as a sequence of the following steps:

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

Arguments:

- `driver`: a driver instance,

- `q-from`: from what element to start dragging; any expression that
`query` function may accept;

- `q-to`: to what element to drag, a seach term.

Notes:

- does not work in Phantom.js since it does not have a virtual mouse API;

- does not work in Safari.
sourceraw docstring

driver?clj

(driver? driver type)
source

edgeclj

Launches Edge driver. A shortcut for boot-driver.

Launches Edge driver. A shortcut for `boot-driver`.
sourceraw docstring

edge-headlessclj

(edge-headless)
(edge-headless opt)

Launches headless Edge driver. A shortcut for boot-driver.

Launches headless Edge driver. A shortcut for `boot-driver`.
sourceraw docstring

edge?clj

(edge? driver)

Returns true if a driver is an Edge instance.

Returns true if a driver is an Edge  instance.
sourceraw docstring

el->refclj

(el->ref el)

Turns machinery-wise element ID into an object that Javascript use to reference existing DOM element.

The magic constant below is taken from the standard: https://www.w3.org/TR/webdriver/#elements

Passing such an object to js-execute automatically expands into a DOM node. For example:

;; returns long UUID (def el (query driver :button-ok))

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

Turns machinery-wise element ID into an object
that Javascript use to reference existing DOM element.

The magic constant below is taken from the standard:
https://www.w3.org/TR/webdriver/#elements

Passing such an object to `js-execute` automatically expands into a
DOM node. For example:

;; returns long UUID
(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)
source

enabled?clj

(enabled? driver q)

Checks whether an element is enabled.

Checks whether an element is enabled.
sourceraw docstring

executeclj

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

Executes an HTTP request to a driver's server. Performs the body within result data bound to the result clause.

Arguments:

  • driver: a driver instance,

  • method: a keyword represents HTTP method, e.g. :get, :post, :delete, etc.

  • path: a vector of strings/keywords represents a server's path. For example:

[:session "aaaa-bbbb-cccc" :element "dddd-eeee" :find]

will turn into "/session/aaaa-bbbb-cccc/element/dddd-eeee/find".

  • data: any data sctructure to be sent as JSON body. Put nil For GET requests.

  • result: a symbol to bind the data from the HTTP response with let form before executing the body.

Example:

(def driver (firefox)) (println (execute {:driver driver :method :get :path [:session (:session driver) :element :active])))

Executes an HTTP request to a driver's server. Performs the body
within result data bound to the `result` clause.

Arguments:

- `driver`: a driver instance,

- `method`: a keyword represents HTTP method, e.g. `:get`, `:post`,
`:delete`, etc.

- `path`: a vector of strings/keywords represents a server's
path. For example:

`[:session "aaaa-bbbb-cccc" :element "dddd-eeee" :find]`

will turn into "/session/aaaa-bbbb-cccc/element/dddd-eeee/find".

- `data`: any data sctructure to be sent as JSON body. Put `nil` For
`GET` requests.

- `result`: a symbol to bind the data from the HTTP response with
`let` form before executing the body.

Example:

(def driver (firefox))
(println (execute {:driver driver
                   :method :get
                   :path [:session (:session driver) :element :active])))
sourceraw docstring

exists?clj

(exists? driver q & more)

Returns true if an element exists on the page.

Keep in mind it does not validates whether the element is visible, clickable and so on.

Returns true if an element exists on the page.

Keep in mind it does not validates whether the element is visible,
clickable and so on.
sourceraw docstring

fillclj

(fill driver q text & more)

Fills an element found with a query with a given text.

0.1.6: now the rest parameters are supported. They will joined using "str":

(fill driver :simple-input "foo" "baz" 1) ;; fills the input with "foobaz1"

Fills an element found with a query with a given text.

0.1.6: now the rest parameters are supported. They will
joined using "str":

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

fill-activeclj

(fill-active driver text & more)

Fills an active element with keys.

Fills an active element with keys.
sourceraw docstring

fill-elcljmultimethod

(fill-el driver el text & more)

Fills an element with text by its identifier.

Fills an element with text by its identifier.
sourceraw docstring

fill-humanclj

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

Fills text like humans do: with error, corrections and pauses.

Arguments:

  • driver: a driver instance,

  • q: a query term, see query function for more info,

  • text: a string to input.

Fills text like humans do: with error, corrections and pauses.

Arguments:

- `driver`: a driver instance,

- `q`: a query term, see `query` function for more info,

- `text`: a string to input.
sourceraw docstring

fill-human-elclj

(fill-human-el driver el text opt)
source

fill-human-multiclj

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

fill-human + fill-multi

`fill-human` + `fill-multi`
sourceraw docstring

fill-multiclj

(fill-multi driver q-text)

Fills multiple inputs in batch.

q-text could be:

  • a map of {query -> text}
  • a vector of [query1 text1 query2 text2 ...]
Fills multiple inputs in batch.

`q-text` could be:

- a map of {query -> text}
- a vector of [query1 text1 query2 text2 ...]
sourceraw docstring

find-elements*cljmultimethod

source

firefoxclj

Launches Firefox driver. A shortcut for boot-driver.

Launches Firefox driver. A shortcut for `boot-driver`.
sourceraw docstring

firefox-headlessclj

(firefox-headless)
(firefox-headless opt)

Launches headless Firefox driver. A shortcut for boot-driver.

Launches headless Firefox driver. A shortcut for `boot-driver`.
sourceraw docstring

firefox?clj

(firefox? driver)

Returns true if a driver is a Firefox instance.

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

format-dateclj

(format-date date pattern)
source

forwardclj

(forward driver)

Move forwards in a browser's history.

Move forwards in a browser's history.
sourceraw docstring

get-alert-textcljmultimethod

Returns a string of text that appears in alert dialog (if present).

Returns a string of text that appears in alert dialog (if present).
sourceraw docstring

(get-cookie driver cookie-name)

Returns the first cookie with such name.

Arguments:

  • driver: a driver instance,

  • cookie-name: a string/keyword witn a cookie name.

Returns the first cookie with such name.

Arguments:

- `driver`: a driver instance,

- `cookie-name`: a string/keyword witn a cookie name.
sourceraw docstring

get-cookiesclj

(get-cookies driver)

Returns all the cookies browser keeps at the moment.

Each cookie is a map with structure:

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

Returns all the cookies browser keeps at the moment.

Each cookie is a map with structure:

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

get-element-attrclj

(get-element-attr driver q name)

Returns an HTTP attribute of an element (class, id, href, etc).

Arguments:

  • driver: a driver instance,

  • q: a query term to find an element,

  • name: either a string or a keyword with a name of an attribute.

Returns: a string with the attribute value, nil if no such attribute for that element.

Note: it does not split CSS classes! A single string with spaces is returned.

Example:

(def driver (firefox)) (get-element-attr driver {:tag :a} :class)

"link link__external link__button" ;; see note above

Returns an HTTP attribute of an element (class, id, href, etc).

Arguments:

- `driver`: a driver instance,

- `q`: a query term to find an element,

- `name`: either a string or a keyword with a name of an attribute.

Returns: a string with the attribute value, `nil` if no such
attribute for that element.

Note: it does not split CSS classes! A single string with spaces is
returned.

Example:

(def driver (firefox))
(get-element-attr driver {:tag :a} :class)
>> "link link__external link__button" ;; see note above
sourceraw docstring

get-element-attr-elclj

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

get-element-attrsclj

(get-element-attrs driver q & attrs)

Returns multiple attributes in batch. The result is a vector of corresponding attributes.

Returns multiple attributes in batch. The result is a vector of
corresponding attributes.
sourceraw docstring

get-element-boxclj

(get-element-box driver q)

Returns a bounding box for an element found with a query term.

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.
Returns a bounding box for an element found with a query term.

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 prop)

Returns a CSS property of an element. The property might be both own or inherited.

Arguments:

  • driver: a driver instance,

  • q: a query term,

  • name: a string/keyword with a CSS name (:font, "background-color", etc).

Returns a string with a value, nil if there is no such property.

Note: colors, fonts and some other properties may be represented in their own ways depending on a browser.

Example:

(def driver (firefox)) (get-element-css driver {:id :content} :background-color)

"rgb(204, 204, 204)" ;; or "rgba(204, 204, 204, 1)"

Returns a CSS property of an element. The property might be both
own or inherited.

Arguments:

- `driver`: a driver instance,

- `q`: a query term,

- `name`: a string/keyword with a CSS name (:font, "background-color", etc).

Returns a string with a value, `nil` if there is no such property.

Note: colors, fonts and some other properties may be represented in
their own ways depending on a browser.

Example:

(def driver (firefox))
(get-element-css driver {:id :content} :background-color)
>> "rgb(204, 204, 204)" ;; or "rgba(204, 204, 204, 1)"
sourceraw docstring

get-element-csssclj

(get-element-csss driver q & props)

Returns multiple CSS properties in batch. The result is a vector of corresponding properties.

Returns multiple CSS properties in batch. The result is a vector of
corresponding properties.
sourceraw docstring

get-element-inner-htmlclj

(get-element-inner-html driver q)

Returns element's inner HTML.

For element el in <div id="el"><p class="foo">hello</p></div> it will be "<p class="foo">hello</p>" string.

Returns element's inner HTML.

For element `el` in `<div id="el"><p class="foo">hello</p></div>` it will
be "<p class="foo">hello</p>" string.
sourceraw docstring

get-element-inner-html-elcljmultimethod

Returns element's inner text by its identifier.

Returns element's inner text by its identifier.
sourceraw docstring

get-element-locationclj

(get-element-location driver q)

Returns an element location on a page as a map with :x and :x keys.

Returns an element location on a page as a map with :x and :x keys.
sourceraw docstring

get-element-location-elcljmultimethod

source

get-element-propertiesclj

(get-element-properties driver q & props)

Returns multiple properties in batch. The result is a vector of corresponding properties.

Returns multiple properties in batch. The result is a vector of
corresponding properties.
sourceraw docstring

get-element-propertyclj

(get-element-property driver q name)

Returns a property of an element (value, etc).

Arguments:

  • driver: a driver instance,

  • q: a query term to find an element,

  • name: either a string or a keyword with a name of a property.

Returns: a string with the attribute value, nil if no such property for that element.

Returns a property of an element (value, etc).

Arguments:

- `driver`: a driver instance,

- `q`: a query term to find an element,

- `name`: either a string or a keyword with a name of a property.

Returns: a string with the attribute value, `nil` if no such
property for that element.
sourceraw docstring

get-element-sizeclj

(get-element-size driver q)

Returns an element size as a map with :width and :height keys.

Returns an element size as a map with :width and :height keys.
sourceraw docstring

get-element-size-elcljmultimethod

source

get-element-tagclj

(get-element-tag driver q)

Returns element's tag name ("div", "input", etc).

Returns element's tag name ("div", "input", etc).
sourceraw docstring

get-element-tag-elclj

(get-element-tag-el driver el)

Returns element's tag name by its identifier.

Returns element's tag name by its identifier.
sourceraw docstring

get-element-textclj

(get-element-text driver q)

Returns inner element's text.

For <p class="foo">hello</p> it will be "hello" string.

Returns inner element's text.

For `<p class="foo">hello</p>` it will be "hello" string.
sourceraw docstring

get-element-text-elclj

(get-element-text-el driver el)

Returns element's inner text by its identifier.

Returns element's inner text by its identifier.
sourceraw docstring

get-element-valuecljmultimethod

(get-element-value driver q)

Returns the current element's value (input text).

Returns the current element's value (input text).
sourceraw docstring

get-hashclj

(get-hash driver)

Returns the current hash fragment (nil when not set).

Returns the current hash fragment (nil when not set).
sourceraw docstring

get-implicit-timeoutclj

(get-implicit-timeout driver)

Returns the current implicit timeout in seconds.

Returns the current implicit timeout in seconds.
sourceraw docstring

get-log-typescljmultimethod

(get-log-types driver)

Returns a set of log types the browser supports.

Returns a set of log types the browser supports.
sourceraw docstring

get-logsclj

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

get-page-load-timeoutclj

(get-page-load-timeout driver)

Returns the current page load timeout in seconds.

Returns the current page load timeout in seconds.
sourceraw docstring

get-pwdclj

(get-pwd)
source

get-script-timeoutclj

(get-script-timeout driver)

Returns the current script timeout in seconds.

Returns the current script timeout in seconds.
sourceraw docstring

get-scrollclj

(get-scroll driver)

Returns the current scroll position as a map with :x and :y keys and integer values.

Returns the current scroll position as a map
with `:x` and `:y` keys and integer values.
sourceraw docstring

get-sourceclj

(get-source driver)

Returns browser's current HTML markup as a string.

Returns browser's current HTML markup as a string.
sourceraw docstring

get-statusclj

(get-status driver)

Returns the current Webdriver status info. The content depends on specific driver.

Returns the current Webdriver status info. The content depends on
specific driver.
sourceraw docstring

get-titleclj

(get-title driver)

Returns the current window's title.

Returns the current window's title.
sourceraw docstring

get-urlclj

(get-url driver)

Returns the current URL string.

Returns the current URL string.
sourceraw docstring

get-window-handlecljmultimethod

(get-window-handle driver)

Returns the current active window handler as a string.

Returns the current active window handler as a string.
sourceraw docstring

get-window-handlescljmultimethod

(get-window-handles driver)

Returns a vector of all window handlers.

Returns a vector of all window handlers.
sourceraw docstring

get-window-positioncljmultimethod

(get-window-position driver)

Returns a window position relative to your screen as a map with :x and :y keys.

Returns a window position relative to your screen as a map with
`:x` and `:y` keys.
sourceraw docstring

get-window-sizecljmultimethod

(get-window-size driver)

Returns a window size a map with :width and :height keys.

Returns a window size a map with `:width` and `:height` keys.
sourceraw docstring

goclj

(go driver url)

Open the URL the current window.

Example:

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

Open the URL the current window.

Example:

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

has-alert?clj

(has-alert? driver)

Checks if there is an alert dialog opened on the page.

Checks if there is an alert dialog opened on the page.
sourceraw docstring

has-class-el?clj

(has-class-el? driver el class)
source

has-class?clj

(has-class? driver q class)

Checks whether an element has a specific class.

Checks whether an element has a specific class.
sourceraw docstring

has-no-alert?clj

Opposite to has-alert?.

Opposite to `has-alert?`.
sourceraw docstring

has-no-class?clj

Opposite to has-class?.

Opposite to `has-class?`.
sourceraw docstring

has-text?clj

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

Returns true if a passed text appears anywhere on a page. With a leading query expression, finds a text inside the first element that matches the query.

Returns true if a passed text appears anywhere on a page.
With a leading query expression, finds a text inside the first
element that matches the query.
sourceraw docstring

headless?clj

(headless? driver)

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

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

intersects?clj

(intersects? driver q1 q2)

Determines whether two elements intersects in geometry meaning.

The implementation compares bounding boxes for each element analyzing their arrangement.

Arguments:

  • q1 and q2 are query terms to find elements to check for intersection.

Returns true or false.

Determines whether two elements intersects in geometry meaning.

The implementation compares bounding boxes for each element
analyzing their arrangement.

Arguments:

- `q1` and `q2` are query terms to find elements to check for
intersection.

Returns true or false.
sourceraw docstring

invisible?clj

Oppsite to visible?.

Oppsite to `visible?`.
sourceraw docstring

join-pathclj

(join-path p1 p2 & more)

Joins two and more path components into a single file path OS-wisely.

Joins two and more path components into a single file path OS-wisely.
sourceraw docstring

js-asynccljmultimethod

(js-async driver script & args)

Executes an asynchronous script in the browser and returns the result. An asynchronous script is a such one that performs any kind of IO operations, say, AJAX request to the server. When running such kind of a script, you cannot just use the return statement like you do in ordinary scripts. Instead, 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, get-script-timeout and with-script-timeout functions/macroses.

Example of a script:

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

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)}); } }});

Arguments:

  • driver: a driver instance,

  • script: a string with the code to execute.

  • args: additional arguments for your code. Any data that might be serialized into JSON.

Executes an asynchronous script in the browser and returns the result.
An asynchronous script is a such one that performs any kind of IO operations,
say, AJAX request to the server. When running such kind of a script, you cannot
just use the `return` statement like you do in ordinary scripts. Instead, 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`, `get-script-timeout`
and `with-script-timeout` functions/macroses.

Example of a script:

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

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)});
  }
}});

Arguments:

- `driver`: a driver instance,

- `script`: a string with the code to execute.

- `args`: additional arguments for your code. Any data that might be
serialized into JSON.
sourceraw docstring

js-executecljmultimethod

(js-execute driver script & args)

Executes Javascript code in browser synchronously.

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

Don't forget to add return <something> operator if you are interested in the result 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).

Arguments:

  • driver: a driver instance,

  • script: a string with the code to execute.

  • args: additional arguments for your code. Any data that might be serialized into JSON.

Example:

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

43

Executes Javascript code in browser synchronously.

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

Don't forget to add `return <something>` operator if you are
interested in the result 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).

Arguments:

- `driver`: a driver instance,

- `script`: a string with the code to execute.

- `args`: additional arguments for your code. Any data that might be
serialized into JSON.

Example:

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

js-localstorage-clearclj

(js-localstorage-clear driver)
source

left-clickclj

(left-click driver)

A shortcut for mouse-click with the left button.

A shortcut for `mouse-click` with the left button.
sourceraw docstring

left-click-onclj

(left-click-on driver q)

Left mouse click on an element. Probably don't need that one, use click instead.

Left mouse click on an element. Probably don't need
that one, use `click` instead.
sourceraw docstring

locator-cssclj

source

locator-xpathclj

source

make-action-inputclj

(make-action-input type)
source

make-key-inputclj

(make-key-input)
source

make-mouse-inputclj

(make-mouse-input)
source

make-pen-inputclj

(make-pen-input)
source

make-pointer-inputclj

(make-pointer-input type)
source

make-screenshot-file-pathclj

(make-screenshot-file-path driver-type dir)
source

make-touch-inputclj

(make-touch-input)
source

make-urlclj

(make-url host port)

Makes an Webdriver URL from a host and port.

Makes an Webdriver URL from a host and port.
sourceraw docstring

maximizecljmultimethod

(maximize driver)

Makes the browser window as wide as your screen allows.

Makes the browser window as wide as your screen allows.
sourceraw docstring

middle-clickclj

(middle-click driver)

A shortcut for mouse-click with the middle button.

A shortcut for `mouse-click` with the middle button.
sourceraw docstring

middle-click-onclj

(middle-click-on driver q)

Move pointer to an element found with a query and middle click on it. Useful for opening links in a new tab.

Move pointer to an element found with a query
and middle click on it. Useful for opening links
in a new tab.
sourceraw docstring

mouse-btn-downcljmultimethod

(mouse-btn-down driver)

Puts down a button of a virtual mouse.

Puts down a button of a virtual mouse.
sourceraw docstring

mouse-btn-upcljmultimethod

(mouse-btn-up driver)

Puts up a button of a virtual mouse.

Puts up a button of a virtual mouse.
sourceraw docstring

mouse-clickcljmultimethod

(mouse-click driver btn)

Click on a mouse button using the current mouse position. The btn is a mouse button code. See keys/mouse-* constants.

Click on a mouse button using the *current* mouse position.
The `btn` is a mouse button code. See `keys/mouse-*` constants.
sourceraw docstring

mouse-click-onclj

(mouse-click-on driver btn q)

Mouse click on a specific element and a button. Moves the mouse pointer to the element first.

Mouse click on a specific element and a button.
Moves the mouse pointer to the element first.
sourceraw docstring

mouse-move-tocljmultimethod

(mouse-move-to driver q)
(mouse-move-to driver x y)

Moves a virtual mouse pointer either to an element or by x and y offset.

Moves a virtual mouse pointer either to an element
or by `x` and `y` offset.
sourceraw docstring

perform-actionscljmultimethod

source

phantomclj

Launches Phantom.js driver. A shortcut for boot-driver.

Launches Phantom.js driver. A shortcut for `boot-driver`.
sourceraw docstring

phantom?clj

(phantom? driver)

Returns true if a driver is a Phantom.js instance.

Returns true if a driver is a Phantom.js instance.
sourceraw docstring

postmortem-handlerclj

(postmortem-handler driver {:keys [dir dir-src dir-img dir-log date-format]})

Internal postmortem handler that creates files. See the with-postmortem's docstring below for more info.

Internal postmortem handler that creates files.
See the `with-postmortem`'s docstring below for more info.
sourceraw docstring

process-logclj

(process-log entry)

Remaps some of the log's fields.

Remaps some of the log's fields.
sourceraw docstring

proxy-envclj

(proxy-env proxy)
source

queryclj

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

Finds an element on a page.

A query might be:

  • a string with an XPath expression;
  • a keyword :active that means to get the current active element;
  • any other keyword which stands for an element's ID attribute;
  • a map with either :xpath or :css key with a string value of corresponding selector type (XPath or CSS);
  • any other map that will be expanded into XPath term (see README.md);
  • a vector of any expressions mentioned above. In that case, each next term is searched from the previous one.

Returns a element's unique identifier.

Finds an element on a page.

A query might be:

- a string with an XPath expression;
- a keyword `:active` that means to get the current active element;
- any other keyword which stands for an element's ID attribute;
- a map with either `:xpath` or `:css` key with a string value
  of corresponding selector type (XPath or CSS);
- any other map that will be expanded into XPath term (see README.md);
- a vector of any expressions mentioned above. In that case, each next
  term is searched from the previous one.

Returns a element's unique identifier.
sourceraw docstring

query-allclj

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

Finds multiple elements on a page. See query function for incoming params. Returns a vector of element identifiers.

Finds multiple elements on a page.
See `query` function for incoming params.
Returns a vector of element identifiers.
sourceraw docstring

query-treeclj

(query-tree driver q & qs)

Takes selectors and acts like a tree. Every next selector queries elements from the previous ones. The fist selector relies on find-elements, and the rest ones use find-elements-from

{:tag :div} {:tag :a} means {:tag :div} -> [div1 div2 div3] div1 -> [a1 a2 a3] div2 -> [a4 a5 a6] div3 -> [a7 a8 a9] so the result will be [a1 ... a9]

Takes selectors and acts like a tree.
Every next selector queries elements from the previous ones.
The fist selector relies on find-elements,
and the rest ones use find-elements-from

{:tag :div} {:tag :a}
means
{:tag :div} -> [div1 div2 div3]
div1 -> [a1 a2 a3]
div2 -> [a4 a5 a6]
div3 -> [a7 a8 a9]
so the result will be [a1 ... a9]
sourceraw docstring

quitclj

(quit driver)

Closes the current session and stops the driver.

Closes the current session and stops the driver.
sourceraw docstring

rand-uuidclj

(rand-uuid)
source

refreshclj

(refresh driver)

Reloads the current window.

Reloads the current window.
sourceraw docstring

release-actionscljmultimethod

source

reloadclj

source

right-clickclj

(right-click driver)

A shortcut for mouse-click with the right button.

A shortcut for `mouse-click` with the right button.
sourceraw docstring

right-click-onclj

(right-click-on driver q)

Move pointer to an element found with a query and right click on it.

Move pointer to an element found with a query
and right click on it.
sourceraw docstring

running?clj

(running? driver)

Check whether a driver runs HTTP server.

Check whether a driver runs HTTP server.
sourceraw docstring

safariclj

Launches Safari driver. A shortcut for boot-driver.

Launches Safari driver. A shortcut for `boot-driver`.
sourceraw docstring

safari?clj

(safari? driver)

Returns true if a driver is a Safari instance.

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

screenshotcljmultimethod

(screenshot driver file)

Takes a screenshot of the current page. Saves it in a *.png file on disk. Rises exception if a screenshot was empty.

Arguments:

  • driver: driver instance,

  • file: either a path to a file or a native java.io.File instance.

Takes a screenshot of the current page. Saves it in a *.png file on disk.
Rises exception if a screenshot was empty.

Arguments:

- `driver`: driver instance,

- `file`: either a path to a file or a native `java.io.File` instance.
sourceraw docstring

screenshot-elementcljmultimethod

(screenshot-element driver q file)
source

scrollclj

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

Scrolls the window into absolute position (jumps to exact place).

Scrolls the window into absolute position (jumps to exact place).
sourceraw docstring

scroll-bottomclj

(scroll-bottom driver)

Scrolls to bottom of the page keeping current horizontal position.

Scrolls to bottom of the page keeping current horizontal position.
sourceraw docstring

scroll-byclj

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

Scrolls the window by offset (relatively the current position).

Scrolls the window by offset (relatively the current position).
sourceraw docstring

scroll-downclj

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

Scrolls the page down by specific number of pixels. The scroll-offset constant is used when not passed.

Scrolls the page down by specific number of pixels.
The `scroll-offset` constant is used when not passed.
sourceraw docstring

scroll-leftclj

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

Scrolls the page left by specific number of pixels. The scroll-offset constant is used when not passed.

Scrolls the page left by specific number of pixels.
The `scroll-offset` constant is used when not passed.
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)

Scrolls to the first element found with a query.

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

See this page for details: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

Scrolls to the first element found with a query.

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

See this page for details:
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
sourceraw docstring

scroll-rightclj

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

Scrolls the page right by specific number of pixels. The scroll-offset constant is used when not passed.

Scrolls the page right by specific number of pixels.
The `scroll-offset` constant is used when not passed.
sourceraw docstring

scroll-topclj

(scroll-top driver)

Scrolls to top of the page keeping current horizontal position.

Scrolls to top of the page keeping current horizontal position.
sourceraw docstring

scroll-upclj

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

Scrolls the page up by specific number of pixels. The scroll-offset constant is used when not passed.

Scrolls the page up by specific number of pixels.
The `scroll-offset` constant is used when not passed.
sourceraw docstring

selectclj

(select driver q text)

Select element in select-box by visible text on click.

Arguments:

  • driver: a driver instance,

  • q: a query term, see query function for more info,

  • text: a string, text in the option you want to select

Select element in select-box by visible text on click.

Arguments:

- `driver`: a driver instance,

- `q`: a query term, see `query` function for more info,

- `text`: a string, text in the option you want to select
sourceraw docstring

selected-el?clj

(selected-el? driver el)
source

selected?clj

(selected? driver q)

Checks whether an element is selected.

Checks whether an element is selected.
sourceraw docstring

(set-cookie driver cookie)

Sets a new cookie.

Arguments:

  • driver: a driver instance,

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

Sets a new cookie.

Arguments:

- `driver`: a driver instance,

- `cookie`: a map with structure described in `get-cookies`. At
least `:name` and `:value` fields should be populated.
sourceraw docstring

set-hashclj

(set-hash driver hash)

Sets a new hash fragment for the current page. Don't include the leading # symbol. Useful when navigating on single page applications.

Sets a new hash fragment for the current page.
Don't include the leading # symbol. Useful when navigating
on single page applications.
sourceraw docstring

set-implicit-timeoutcljmultimethod

(set-implicit-timeout driver sec)

Sets timeout that is used when finding elements on the page.

Sets timeout that is used when finding elements on the page.
sourceraw docstring

set-page-load-timeoutcljmultimethod

(set-page-load-timeout driver sec)

Sets timeout for loading pages.

Sets timeout for loading pages.
sourceraw docstring

set-script-timeoutcljmultimethod

(set-script-timeout driver sec)

Sets timeout for executing JS sctipts.

Sets timeout for executing JS sctipts.
sourceraw docstring

set-window-positionclj

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

Sets new position for a window. Absolute precision is not guaranteed.

Sets new position for a window. Absolute precision is not
guaranteed.
sourceraw docstring

set-window-sizeclj

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

Sets new size for a window. Absolute precision is not guaranteed.

Sets new size for a window. Absolute precision is not guaranteed.
sourceraw docstring

stop-driverclj

(stop-driver driver)

Stops the driver's process. Removes proces's data from the driver instance. Returns a modified driver.

Stops the driver's process. Removes proces's data from the driver
instance. Returns a modified driver.
sourceraw docstring

submitclj

(submit driver q)

Sends Enter button value to an element found with query.

Sends Enter button value to an element found with query.
sourceraw docstring

supports-logs?clj

(supports-logs? driver)

Checks whether a driver supports getting console logs.

Checks whether a driver supports getting console logs.
sourceraw docstring

switch-frameclj

(switch-frame driver q)

Switches to an (i)frame quering the page for it.

Switches to an (i)frame quering the page for it.
sourceraw docstring

switch-frame*clj

(switch-frame* driver id)

Switches to an (i)frame by its index or an element reference.

Switches to an (i)frame by its index or an element reference.
sourceraw docstring

switch-frame-firstclj

(switch-frame-first driver)

Switches to the first (i)frame.

Switches to the first (i)frame.
sourceraw docstring

switch-frame-parentclj

(switch-frame-parent driver)

Switches to the parent of the current (i)frame.

Switches to the parent of the current (i)frame.
sourceraw docstring

switch-frame-topclj

(switch-frame-top driver)

Switches to the most top of the page.

Switches to the most top of the page.
sourceraw docstring

switch-windowcljmultimethod

(switch-window driver handle)

Switches a browser to another window.

Switches a browser to another window.
sourceraw docstring

switch-window-nextclj

(switch-window-next driver)
source

touch-downcljmultimethod

source

touch-movecljmultimethod

source

touch-tapcljmultimethod

source

touch-upcljmultimethod

source

upload-filecljmultimethod

Attaches a local file to a file input field.

Arguments:

  • q is a query term that refers to a file input;
  • file is either a string or java.io.File object that references a local file. The file should exist.

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

Attaches a local file to a file input field.

Arguments:

- `q` is a query term that refers to a file input;
- `file` is either a string or java.io.File object
that references a local file. The file should exist.

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

use-cssclj

(use-css driver)
source

use-locatorclj

(use-locator driver locator)
source

use-xpathclj

(use-xpath driver)
source

visible?clj

(visible? driver q)

Checks whether an element is visible on the page.

Checks whether an element is visible on the page.
sourceraw docstring

waitclj

(wait sec)
(wait driver sec)

Sleeps for N seconds.

Sleeps for N seconds.
sourceraw docstring

wait-absentclj

(wait-absent driver q & [opt])

Waits until an element is absent.

Arguments:

  • driver: a driver instance;
  • q: a query term (see query);
  • opt: a map of options (see wait-predicate).
Waits until an element is absent.

Arguments:

- `driver`: a driver instance;
- `q`: a query term (see `query`);
- `opt`: a map of options (see `wait-predicate`).
sourceraw docstring

wait-disabledclj

(wait-disabled driver q & [opt])

Waits until an element is disabled (usually an input element).

Arguments:

  • driver: a driver instance;
  • q: a query term (see query);
  • opt: a map of options (see wait-predicate).
Waits until an element is disabled (usually an input element).

Arguments:

- `driver`: a driver instance;
- `q`: a query term (see `query`);
- `opt`: a map of options (see `wait-predicate`).
sourceraw docstring

wait-enabledclj

(wait-enabled driver q & [opt])

Waits until an element is enabled (usually an input element).

Arguments:

  • driver: a driver instance;
  • q: a query term (see query);
  • opt: a map of options (see wait-predicate).
Waits until an element is enabled (usually an input element).

Arguments:

- `driver`: a driver instance;
- `q`: a query term (see `query`);
- `opt`: a map of options (see `wait-predicate`).
sourceraw docstring

wait-existsclj

(wait-exists driver q & [opt])

Waits until an element exists on a page (but may not be visible though).

Arguments:

  • driver: a driver instance;
  • q: a query term (see query);
  • opt: a map of options (see wait-predicate).
Waits until an element exists on a page (but may not be visible though).

Arguments:

- `driver`: a driver instance;
- `q`: a query term (see `query`);
- `opt`: a map of options (see `wait-predicate`).
sourceraw docstring

wait-has-alertclj

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

Waits until an alert dialog appears on the screen.

Arguments:

  • driver: a driver instance;
  • q: a query term (see query);
  • opt: a map of options (see wait-predicate).
Waits until an alert dialog appears on the screen.

Arguments:

- `driver`: a driver instance;
- `q`: a query term (see `query`);
- `opt`: a map of options (see `wait-predicate`).
sourceraw docstring

wait-has-classclj

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

Waits until an element has specific class.

Arguments:

  • driver: a driver instance;
  • q: a query term (see query);
  • class: a class to search as string;
  • opt: a map of options (see wait-predicate).
Waits until an element has specific class.

Arguments:

- `driver`: a driver instance;
- `q`: a query term (see `query`);
- `class`: a class to search as string;
- `opt`: a map of options (see `wait-predicate`).
sourceraw docstring

wait-has-textclj

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

Waits until an element has text anywhere inside it (including inner HTML).

Arguments:

  • driver: a driver instance;
  • q: a query term (see query).
  • text: a string to search;
  • opt: a map of options (see wait-predicate).
Waits until an element has text anywhere inside it (including inner HTML).

Arguments:

- `driver`: a driver instance;
- `q`: a query term (see `query`).
- `text`: a string to search;
- `opt`: a map of options (see `wait-predicate`).
sourceraw docstring

wait-has-text-everywhereclj

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

Like wait-has-text but searches for text across the entire page.

Arguments:

  • driver: a driver instance;
  • text: a string to search;
  • opt: a map of options (see wait-predicate).
Like `wait-has-text` but searches for text across the entire page.

Arguments:

- `driver`: a driver instance;
- `text`: a string to search;
- `opt`: a map of options (see `wait-predicate`).
sourceraw docstring

wait-invisibleclj

(wait-invisible driver q & [opt])

Waits until an element presents but not visible.

Arguments:

  • driver: a driver instance;
  • q: a query term (see query);
  • opt: a map of options (see wait-predicate).
Waits until an element presents but not visible.

Arguments:

- `driver`: a driver instance;
- `q`: a query term (see `query`);
- `opt`: a map of options (see `wait-predicate`).
sourceraw docstring

wait-predicateclj

(wait-predicate pred)
(wait-predicate pred opt)

Sleeps continuously calling a predicate until it returns true. Raises a slingshot exception when timeout is reached.

Arguments:

  • pred: a zero-argument predicate to call;
  • opt: a map of optional parameters: -- :timeout wait limit in seconds, 20 by default; -- :interval how long to wait b/w calls, 0.33 by default; -- :message a message that becomes a part of exception when timeout is reached.
Sleeps continuously calling a predicate until it returns true.
Raises a slingshot exception when timeout is reached.

Arguments:

- `pred`: a zero-argument predicate to call;
- `opt`: a map of optional parameters:
-- `:timeout` wait limit in seconds, 20 by default;
-- `:interval` how long to wait b/w calls, 0.33 by default;
-- `:message` a message that becomes a part of exception when timeout is reached.
sourceraw docstring

wait-runningclj

(wait-running driver & [opt])
source

wait-visibleclj

(wait-visible driver q & [opt])

Waits until an element presents and is visible.

Arguments:

  • driver: a driver instance;
  • q: a query term (see query);
  • opt: a map of options (see wait-predicate).
Waits until an element presents and is visible.

Arguments:

- `driver`: a driver instance;
- `q`: a query term (see `query`);
- `opt`: a map of options (see `wait-predicate`).
sourceraw docstring

when-chromecljmacro

(when-chrome driver & body)

Executes the body only if the driver is Chrome.

Example:

(def driver (chrome)) (when-chrome driver (println "It's Chrome!")

Executes the body only if the driver is Chrome.

Example:

(def driver (chrome))
(when-chrome driver
  (println "It's Chrome!")
sourceraw docstring

when-edgecljmacro

(when-edge driver & body)

Executes the body only if the driver is Edge.

Executes the body only if the driver is Edge.
sourceraw docstring

when-firefoxcljmacro

(when-firefox driver & body)

Executes the body only if the driver is Firefox.

Executes the body only if the driver is Firefox.
sourceraw docstring

when-headlesscljmacro

(when-headless driver & body)

Executes the body only if the driver is run in headless mode.

Executes the body only if the driver is run in headless mode.
sourceraw docstring

when-not-chromecljmacro

(when-not-chrome driver & body)

Executes the body only if a browser is NOT Chrome.

Executes the body only if a browser is NOT Chrome.
sourceraw docstring

when-not-driverscljmacro

(when-not-drivers browsers driver & body)

Executes the body only if a browsers is NOT in set #{:browser1 :browser2}

Executes the body only if a browsers is NOT in set #{:browser1 :browser2}
sourceraw docstring

when-not-edgecljmacro

(when-not-edge driver & body)

Executes the body only if a browser is NOT Edge.

Executes the body only if a browser is NOT Edge.
sourceraw docstring

when-not-firefoxcljmacro

(when-not-firefox driver & body)

Executes the body only if a browser is NOT Firefox.

Executes the body only if a browser is NOT Firefox.
sourceraw docstring

when-not-headlesscljmacro

(when-not-headless driver & body)

Executes the body only if a browser is NOT run in headless mode.

Executes the body only if a browser is NOT run in headless mode.
sourceraw docstring

when-not-phantomcljmacro

(when-not-phantom driver & body)

Executes the body only if a browser is NOT Phantom.js.

Executes the body only if a browser is NOT Phantom.js.
sourceraw docstring

when-not-predicatecljmacro

(when-not-predicate predicate & body)
source

when-not-safaricljmacro

(when-not-safari driver & body)

Executes the body only if a browser is NOT Safari.

Executes the body only if a browser is NOT Safari.
sourceraw docstring

when-phantomcljmacro

(when-phantom driver & body)

Executes the body only if the driver is Phantom.js.

Executes the body only if the driver is Phantom.js.
sourceraw docstring

when-predicatecljmacro

(when-predicate predicate & body)

Executes the body only if a predicate returns true.

Executes the body only if a predicate returns true.
sourceraw docstring

when-safaricljmacro

(when-safari driver & body)

Executes the body only if the driver is Safari.

Executes the body only if the driver is Safari.
sourceraw docstring

with-chromecljmacro

(with-chrome opt bind & body)

Performs the body with Chrome session. A shortcut for with-driver.

Performs the body with Chrome session. A shortcut for
`with-driver`.
sourceraw docstring

with-chrome-headlesscljmacro

(with-chrome-headless opt bind & body)

Performs the body with headless Chrome session. A shortcut for with-driver.

Performs the body with headless Chrome session. A shortcut for
`with-driver`.
sourceraw docstring

with-csscljmacro

(with-css driver & body)
source

with-drivercljmacro

(with-driver type opt bind & body)

Performs the body within a driver session.

Launches a driver of a given type. Binds the driver instance to a passed bind symbol. Executes the body once the driver has started. Shutdowns the driver finally (even if an exception occurred).

Arguments:

  • type is a keyword what driver type to start.

  • opt is a map with driver's options. See boot-driver for more details.

  • bind is a symbol to bind a driver reference.

Example:

(with-driver :firefox {} driver (go driver "http://example.com"))

Performs the body within a driver session.

Launches a driver of a given type. Binds the driver instance to a
passed `bind` symbol. Executes the body once the driver has
started. Shutdowns the driver finally (even if an exception
occurred).

Arguments:

- `type` is a keyword what driver type to start.

- `opt` is a map with driver's options. See `boot-driver` for more
details.

- `bind` is a symbol to bind a driver reference.

Example:

(with-driver :firefox {} driver
  (go driver "http://example.com"))
sourceraw docstring

with-edgecljmacro

(with-edge opt bind & body)

Performs the body with Edge session. A shortcut for with-driver.

Performs the body with Edge session. A shortcut for
`with-driver`.
sourceraw docstring

with-edge-headlesscljmacro

(with-edge-headless opt bind & body)

Performs the body with headless Edge session. A shortcut for with-driver.

Performs the body with headless Edge session. A shortcut for
`with-driver`.
sourceraw docstring

with-exceptioncljmacro

(with-exception catch fallback & body)
source

with-firefoxcljmacro

(with-firefox opt bind & body)

Performs the body with Firefox session. A shortcut for with-driver.

Performs the body with Firefox session. A shortcut for
`with-driver`.
sourceraw docstring

with-firefox-headlesscljmacro

(with-firefox-headless opt bind & body)

Performs the body with headless Firefox session. A shortcut for with-driver.

Performs the body with headless Firefox session. A shortcut for
`with-driver`.
sourceraw docstring

with-framecljmacro

(with-frame driver q & body)

Switches to the (i)frame temporary while executing the body returning the result of the last expression.

Switches to the (i)frame temporary while executing the body
returning the result of the last expression.
sourceraw docstring

with-http-errorcljmacro

(with-http-error & body)
source

with-key-downcljmacro

(with-key-down input key & body)
source

with-locatorcljmacro

(with-locator driver locator & body)
source

with-mouse-btncljmacro

(with-mouse-btn driver & body)

Performs the body keeping mouse botton pressed.

Performs the body keeping mouse botton pressed.
sourceraw docstring

with-phantomcljmacro

(with-phantom opt bind & body)

Performs the body with Phantom.js session. A shortcut for with-driver.

Performs the body with Phantom.js session. A shortcut for
`with-driver`.
sourceraw docstring

with-pointer-btn-downcljmacro

(with-pointer-btn-down input button & body)
source

with-pointer-left-btn-downcljmacro

(with-pointer-left-btn-down input & body)
source

with-postmortemcljmacro

(with-postmortem driver opt & body)

Wraps the body with postmortem handler. If any error occurs, it will save a screenshot, the page's source code and console logs (if supported) on disk before rising an exception. Having them could help you to discover what happened.

Note: do not use it in test's fixtures. The standard clojure.test framework has its own way of handling exceptions, so wrapping a fixture with (with-postmortem...) would be in vain.

Arguments:

  • driver: a driver instance,

  • opt: a map of options, where:

-- :dir path to a directory where to store artifacts by default. Might not exist, will be created otherwise. When not passed, the current working directory (pwd) is used.

-- :dir-img: path to a directory where to store .png files (screenshots). If nil, :dir value is used.

-- :dir-src: path to a directory where to store .html files (page source). If nil, :dir value is used.

-- :dir-log: path to a directory where to store .json files with console logs. If nil, :dir value is used.

-- :date-format: a string represents date(time) pattern to make filenames unique. Default is "yyyy-MM-dd-HH-mm-ss". See Oracle Java SimpleDateFormat class manual for more patterns.

Wraps the body with postmortem handler. If any error occurs,
it will save a screenshot, the page's source code and console logs
(if supported) on disk before rising an exception. Having them
could help you to discover what happened.

Note: do not use it in test's fixtures. The standard `clojure.test`
framework has its own way of handling exceptions, so wrapping a fixture
with `(with-postmortem...)` would be in vain.

Arguments:

- `driver`: a driver instance,

- `opt`: a map of options, where:

-- `:dir` path to a directory where to store artifacts by default.
Might not exist, will be created otherwise. When not passed,
the current working directory (`pwd`) is used.

-- `:dir-img`: path to a directory where to store `.png`
files (screenshots). If `nil`, `:dir` value is used.

-- `:dir-src`: path to a directory where to store `.html`
files (page source). If `nil`, `:dir` value is used.

-- `:dir-log`: path to a directory where to store `.json`
files with console logs. If `nil`, `:dir` value is used.

-- `:date-format`: a string represents date(time) pattern to make
filenames unique. Default is "yyyy-MM-dd-HH-mm-ss". See Oracle
Java `SimpleDateFormat` class manual for more patterns.
sourceraw docstring

with-safaricljmacro

(with-safari opt bind & body)

Performs the body with Safari session. A shortcut for with-driver.

Performs the body with Safari session. A shortcut for
`with-driver`.
sourceraw docstring

with-screenshotscljmacro

(with-screenshots driver dir & body)

Makes a screenshot after each form

Makes a screenshot after each form
sourceraw docstring

with-script-timeoutcljmacro

(with-script-timeout driver sec & body)

Performs the body setting the script timeout temporary. Useful for async JS scripts.

Performs the body setting the script timeout temporary.
Useful for async JS scripts.
sourceraw docstring

with-waitcljmacro

(with-wait n & body)

Executes the body waiting for n seconds before each form. Returns a value of the last form. Use that macros to perform a bunch of actions slowly. Some SPA applications need extra time to re-render the content.

Executes the body waiting for n seconds before each form.
Returns a value of the last form. Use that macros to perform
a bunch of actions slowly. Some SPA applications need extra time
to re-render the content.
sourceraw docstring

with-wait-intervalcljmacro

(with-wait-interval sec & body)
source

with-wait-timeoutcljmacro

(with-wait-timeout sec & body)
source

with-xpathcljmacro

(with-xpath driver & body)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close