Liking cljdoc? Tell your friends :D

clj-webdriver.core


->actionscljmacro

(->actions driver & body)
source

->build-composite-actioncljmacro

(->build-composite-action driver & body)

Create a composite chain of actions, then call .build(). This does not execute the actions; it simply sets up an 'action chain' which can later by executed using .perform().

Unless you need to wait to execute your composite actions, you should prefer ->actions to this macro.

Create a composite chain of actions, then call `.build()`. This does **not** execute the actions; it simply sets up an 'action chain' which can later by executed using `.perform()`.

Unless you need to wait to execute your composite actions, you should prefer `->actions` to this macro.
sourceraw docstring

by-attr-containsclj

(by-attr-contains attr value)
(by-attr-contains tag attr value)

Match if value is contained in the value of attr. You can optionally specify the tag. For example: (by-attr-contains :class "navigation") (by-attr-contains :ul :class "tags")

Match if `value` is contained in the value of `attr`. You can optionally specify the tag.
For example: `(by-attr-contains :class "navigation")`
             `(by-attr-contains :ul :class "tags")`
sourceraw docstring

by-attr-endsclj

(by-attr-ends attr value)
(by-attr-ends tag attr value)

Match if value is at the end of the value of attr. You can optionally specify the tag.

Match if `value` is at the end of the value of `attr`. You can optionally specify the tag.
sourceraw docstring

by-attr-startsclj

(by-attr-starts attr value)
(by-attr-starts tag attr value)

Match if value is at the beginning of the value of attr. You can optionally specify the tag.

Match if `value` is at the beginning of the value of `attr`. You can optionally specify the tag.
sourceraw docstring

by-attr=clj

(by-attr= attr value)
(by-attr= tag attr value)

Use value of arbitrary attribute attr to find an element. You can optionally specify the tag. For example: (by-attr= :id "element-id") (by-attr= :div :class "content")

Use `value` of arbitrary attribute `attr` to find an element. You can optionally specify the tag.
For example: `(by-attr= :id "element-id")`
             `(by-attr= :div :class "content")`
sourceraw docstring

by-class-nameclj

(by-class-name expr)

Used when finding elements. Returns By/className of expr

Used when finding elements. Returns `By/className` of `expr`
sourceraw docstring

by-cssclj

(by-css expr)

Used when finding elements. Returns By/cssSelector of expr

Used when finding elements. Returns `By/cssSelector` of `expr`
sourceraw docstring

by-css-selectorclj

source

by-has-attrclj

(by-has-attr attr)
(by-has-attr tag attr)

Match if the element has the attribute attr, regardless of its value. You can optionally specify the tag.

Match if the element has the attribute `attr`, regardless of its value. You can optionally specify the tag.
sourceraw docstring

by-idclj

(by-id expr)

Used when finding elements. Returns By/id of expr

Used when finding elements. Returns `By/id` of `expr`
sourceraw docstring

(by-link-text expr)

Used when finding elements. Returns By/linkText of expr

Used when finding elements. Returns `By/linkText` of `expr`
sourceraw docstring

by-nameclj

(by-name expr)

Used when finding elements. Returns By/name of expr

Used when finding elements. Returns `By/name` of `expr`
sourceraw docstring

(by-partial-link-text expr)

Used when finding elements. Returns By/partialLinkText of expr

Used when finding elements. Returns `By/partialLinkText` of `expr`
sourceraw docstring

by-queryclj

(by-query {:keys [xpath css] :as m})

Given a map with either an :xpath or :css key, return the respective by-* function (by-xpath or by-css) using the value for that key.

Given a map with either an `:xpath` or `:css` key, return the respective by-* function (`by-xpath` or `by-css`) using the value for that key.
sourceraw docstring

by-tagclj

(by-tag expr)

Used when finding elements. Returns By/tagName of expr

Used when finding elements. Returns `By/tagName` of `expr`
sourceraw docstring

by-xpathclj

(by-xpath expr)

Used when finding elements. Returns By/xpath of expr

Used when finding elements. Returns `By/xpath` of `expr`
sourceraw docstring

execute-scriptclj

(execute-script driver js & js-args)
source

execute-script*clj

(execute-script* driver js & js-args)

Version of execute-script that uses a WebDriver instance directly.

Version of execute-script that uses a WebDriver instance directly.
sourceraw docstring

find-element*clj

(find-element* driver attr-val)
source

find-elements*clj

(find-elements* driver attr-val)
source

IActionscljprotocol

Methods available in the Actions class

Methods available in the Actions class

move-by-offsetclj

(move-by-offset driver x y)

Move mouse by x pixels to the right and y pixels down.

Move mouse by `x` pixels to the right and `y` pixels down.

double-clickclj

(double-click this)
(double-click this element)

Double click, either at the current mouse position or in the middle of a given element.

Double click, either at the current mouse position or in the middle of a given `element`.

releaseclj

(release this)
(release this element)

Release the left mouse button, either at the current mouse position or in the middle of the given element.

Release the left mouse button, either at the current mouse position or in the middle of the given `element`.

key-downclj

(key-down this k)
(key-down this element k)

Press the given key (e.g., (key-press driver :enter))

Press the given key (e.g., (key-press driver :enter))

drag-and-dropclj

(drag-and-drop this element-a element-b)

Drag and drop element-a onto element-b.

Drag and drop `element-a` onto `element-b`.

performclj

(perform this)

Perform the composite action chain.

Perform the composite action chain.

drag-and-drop-byclj

(drag-and-drop-by this element x-y-map)

Drag element by x pixels to the right and y pixels down.

Drag `element` by `x` pixels to the right and `y` pixels down.

click-and-holdclj

(click-and-hold this)
(click-and-hold this element)

Drag and drop, either at the current mouse position or in the middle of a given element.

Drag and drop, either at the current mouse position or in the middle of a given `element`.

move-to-elementclj

(move-to-element this element)
(move-to-element this element x y)

Move the mouse to the given element, or to an offset from the given element.

Move the mouse to the given element, or to an offset from the given element.

key-upclj

(key-up this k)
(key-up this element k)

Release the given key (e.g., (key-press driver :enter))

Release the given key (e.g., (key-press driver :enter))
sourceraw docstring

IAlertcljprotocol

Simple interactions with alert popups

Simple interactions with alert popups

acceptclj

(accept driver)

Accept the dialog. Equivalent to pressing 'Ok'

Accept the dialog. Equivalent to pressing 'Ok'

alert-objclj

(alert-obj driver)

Return the underlying Java object that can be used with the Alert Java API (exposed until all functionality is ported)

Return the underlying Java object that can be used with the Alert Java API (exposed until all functionality is ported)

alert-textclj

(alert-text driver)

Get the text of the popup dialog's message

Get the text of the popup dialog's message

dismissclj

(dismiss driver)

Dismiss the dialog. Equivalent to pressing 'Cancel'

Dismiss the dialog. Equivalent to pressing 'Cancel'
sourceraw docstring

IDrivercljprotocol

Basics of driver handling

Basics of driver handling

quitclj

(quit driver)

Destroy this browser instance

Destroy this browser instance

page-sourceclj

(page-source driver)

Retrieve the source code of the current page

Retrieve the source code of the current page

current-urlclj

(current-url driver)

Retrieve the URL of the current page

Retrieve the URL of the current page

toclj

(to driver url)

Navigate to a particular URL. Arg url can be either String or java.net.URL. Equivalent to the get function, provided here for compatibility with WebDriver API.

Navigate to a particular URL. Arg `url` can be either String or java.net.URL. Equivalent to the `get` function, provided here for compatibility with WebDriver API.

get-urlclj

(get-url driver url)

Navigate the driver to a given URL

Navigate the driver to a given URL

refreshclj

(refresh driver)

Refresh the current page

Refresh the current page

forwardclj

(forward driver)

Go forward to the next page in "browsing history".

Go forward to the next page in "browsing history".

get-screenshotclj

(get-screenshot driver)
(get-screenshot driver format)
(get-screenshot driver format destination)

Take a screenshot using Selenium-WebDriver's getScreenshotAs method

Take a screenshot using Selenium-WebDriver's getScreenshotAs method

closeclj

(close driver)

Close this browser instance, switching to an active one if more than one is open

Close this browser instance, switching to an active one if more than one is open

titleclj

(title driver)

Retrieve the title of the current page as defined in the head tag

Retrieve the title of the current page as defined in the `head` tag

backclj

(back driver)

Go back to the previous page in "browsing history"

Go back to the previous page in "browsing history"
sourceraw docstring

IElementcljprotocol

Basic actions on elements

Basic actions on elements

tagclj

(tag element)

Retrieve the name of the HTML tag of the given element object (returned as a keyword)

Retrieve the name of the HTML tag of the given element object (returned as a keyword)

present?clj

(present? element)

Returns true if the element exists and is visible

Returns true if the element exists and is visible

locationclj

(location element)

Given an element object, return its location as a map of its x/y coordinates

Given an element object, return its location as a map of its x/y coordinates

textclj

(text element)

Retrieve the content, or inner HTML, of a given element object

Retrieve the content, or inner HTML, of a given element object

htmlclj

(html element)

Retrieve the outer HTML of an element

Retrieve the outer HTML of an element

attributeclj

(attribute element attr)

Retrieve the value of the attribute of the given element object

Retrieve the value of the attribute of the given element object

location-once-visibleclj

(location-once-visible element)

Given an element object, return its location on the screen once it is scrolled into view as a map of its x/y coordinates. The window will scroll as much as possible until the element hits the top of the page; thus even visible elements will be scrolled until they reach that point.

Given an element object, return its location on the screen once it is scrolled into view as a map of its x/y coordinates. The window will scroll as much as possible until the element hits the top of the page; thus even visible elements will be scrolled until they reach that point.

visible?clj

(visible? element)

Returns true if the given element object is visible/displayed

Returns true if the given element object is visible/displayed

intersects?clj

(intersects? element-a element-b)

Return true if element-a intersects with element-b. This mirrors the Selenium-WebDriver API method, but see the intersect? function to compare an element against multiple other elements for intersection.

Return true if `element-a` intersects with `element-b`. This mirrors the Selenium-WebDriver API method, but see the `intersect?` function to compare an element against multiple other elements for intersection.

valueclj

(value element)

Retrieve the value attribute of the given element object

Retrieve the `value` attribute of the given element object

flashclj

(flash element)

Flash the element in question, to verify you're looking at the correct element

Flash the element in question, to verify you're looking at the correct element

xpathclj

(xpath element)

Retrieve the XPath of an element

Retrieve the XPath of an element

css-valueclj

(css-value element property)

Return the value of the given CSS property

Return the value of the given CSS property

sizeclj

(size element)

Return the size of the given element as a map containing :width and :height values in pixels.

Return the size of the given `element` as a map containing `:width` and `:height` values in pixels.

clickclj

(click element)

Click a particular HTML element

Click a particular HTML element

displayed?clj

(displayed? element)

Returns true if the given element object is visible/displayed

Returns true if the given element object is visible/displayed

exists?clj

(exists? element)

Returns true if the given element exists

Returns true if the given element exists

focusclj

(focus element)

Apply focus to the given element

Apply focus to the given element
sourceraw docstring

IFindcljprotocol

Functions used to locate elements on a given page

Functions used to locate elements on a given page

find-windowclj

(find-window driver attr-val)

Given a browser driver and a map of attributes, return the windows that match

Given a browser `driver` and a map of attributes, return the windows that match

find-elements-byclj

(find-elements-by this by)

Retrieve a seq of element objects described by by, optionally limited to elements beneath a parent element (depends on dispatch). Prefer find-elements to this function unless you know what you're doing.

Retrieve a seq of element objects described by `by`, optionally limited to elements beneath a parent element (depends on dispatch). Prefer `find-elements` to this function unless you know what you're doing.

find-elementsclj

(find-elements this locator)

Find all elements that match the parameters supplied in the attr-val map. Also provides a shortcut to find-by-hierarchy if a vector is supplied instead of a map.

Find all elements that match the parameters supplied in the `attr-val` map. Also provides a shortcut to `find-by-hierarchy` if a vector is supplied instead of a map.

find-by-hierarchyclj

(find-by-hierarchy driver hierarchy-vector)

Given a Webdriver driver and a vector hierarchy-vector, return a lazy seq of the described elements in the hierarchy dictated by the order of elements in the hierarchy-vector.

Given a Webdriver `driver` and a vector `hierarchy-vector`, return a lazy seq of the described elements in the hierarchy dictated by the order of elements in the `hierarchy-vector`.

find-windowsclj

(find-windows driver attr-val)

Given a browser driver and a map of attributes, return the windows that match

Given a browser `driver` and a map of attributes, return the windows that match

find-table-rowclj

(find-table-row driver table row-index)

Return all cells in the row of the given table element, row-index as a zero-based index of the target row.

Return all cells in the row of the given table element, `row-index` as a zero-based index of the target row.

find-element-byclj

(find-element-by this by)

Retrieve the element object of an element described by by, optionally limited to elements beneath a parent element (depends on dispatch). Prefer find-element to this function unless you know what you're doing.

Retrieve the element object of an element described by `by`, optionally limited to elements beneath a parent element (depends on dispatch). Prefer `find-element` to this function unless you know what you're doing.

find-table-cellclj

(find-table-cell driver table coordinates)

Given a driver, a table element, and a zero-based set of coordinates for row and column, return the table cell at those coordinates for the given table.

Given a `driver`, a `table` element, and a zero-based set of coordinates for row and column, return the table cell at those coordinates for the given table.

find-elementclj

(find-element this locator)

Call (first (find-elements args))

Call (first (find-elements args))
sourceraw docstring

IFormElementcljprotocol

Actions for form elements

Actions for form elements

selected?clj

(selected? element)

Returns true if the given element object is selected

Returns true if the given element object is selected

selectclj

(select element)

Select a given element object

Select a given element object

clearclj

(clear element)

Clear the contents of the given element object

Clear the contents of the given element object

deselectclj

(deselect element)

Deselect a given element object

Deselect a given element object

input-textclj

(input-text element s)

Type the string of keys into the element object

Type the string of keys into the element object

submitclj

(submit element)

Submit the form which contains the given element object

Submit the form which contains the given element object

send-keysclj

(send-keys element s)

Type the string of keys into the element object

Type the string of keys into the element object

toggleclj

(toggle element)

If the given element object is a checkbox, this will toggle its selected/unselected state. In Selenium 2, .toggle() was deprecated and replaced in usage by .click().

If the given element object is a checkbox, this will toggle its selected/unselected state. In Selenium 2, `.toggle()` was deprecated and replaced in usage by `.click()`.

enabled?clj

(enabled? element)

Returns true if the given element object is enabled

Returns true if the given element object is enabled
sourceraw docstring

ISelectElementcljprotocol

Actions specific to select lists

Actions specific to select lists

select-by-valueclj

(select-by-value select-element value)

Select all options with value value in the select list described by by

Select all options with value `value` in the select list described by `by`

select-by-indexclj

(select-by-index select-element idx)

Select an option by its index in the given select list. Indeces begin at 0.

Select an option by its index in the given select list. Indeces begin at 0.

deselect-by-textclj

(deselect-by-text select-element text)

Deselect all options with visible text text for the select list described by by

Deselect all options with visible text `text` for the select list described by `by`

select-optionclj

(select-option select-element attr-val)

Select an option from a select list, either by :value, :index or :text

Select an option from a select list, either by `:value`, `:index` or `:text`

all-selected-optionsclj

(all-selected-options select-element)

Retrieve a seq of all selected options from the select list described by by

Retrieve a seq of all selected options from the select list described by `by`

select-by-textclj

(select-by-text select-element text)

Select all options with visible text text in the select list described by by

Select all options with visible text `text` in the select list described by `by`

deselect-allclj

(deselect-all select-element)

Deselect all options for a given select list. Does not leverage WebDriver method because WebDriver's isMultiple method is faulty.

Deselect all options for a given select list. Does not leverage WebDriver method because WebDriver's isMultiple method is faulty.

first-selected-optionclj

(first-selected-option select-element)

Retrieve the first selected option (or the only one for single-select lists) from the given select list

Retrieve the first selected option (or the only one for single-select lists) from the given select list

deselect-optionclj

(deselect-option select-element attr-val)

Deselect an option from a select list, either by :value, :index or :text

Deselect an option from a select list, either by `:value`, `:index` or `:text`

select-allclj

(select-all select-element)

Select all options for a given select list

Select all options for a given select list

deselect-by-indexclj

(deselect-by-index select-element idx)

Deselect the option at index idx for the select list described by by. Indeces begin at 0

Deselect the option at index `idx` for the select list described by `by`. Indeces begin at 0

multiple?clj

(multiple? select-element)

Return true if the given select list allows for multiple selections

Return true if the given select list allows for multiple selections

deselect-by-valueclj

(deselect-by-value select-element value)

Deselect all options with value value for the select list described by by

Deselect all options with value `value` for the select list described by `by`

all-optionsclj

(all-options select-element)

Retrieve all options from the given select list

Retrieve all options from the given select list
sourceraw docstring

ITargetLocatorcljprotocol

Functions that deal with browser windows and frames

Functions that deal with browser windows and frames

other-windowsclj

(other-windows driver)

Retrieve window handles for all windows except the current one

Retrieve window handles for all windows except the current one

switch-to-activeclj

(switch-to-active driver)

Switch to element that currently has focus, or to the body if this cannot be detected

Switch to element that currently has focus, or to the body if this cannot be detected

switch-to-defaultclj

(switch-to-default driver)

Switch focus to the first first frame of the page, or the main document if the page contains iframes

Switch focus to the first first frame of the page, or the main document if the page contains iframes

switch-to-frameclj

(switch-to-frame driver frame)

Switch focus to a particular HTML frame by supplying an Element or an integer for the nth frame on the page (zero-based index)

Switch focus to a particular HTML frame by supplying an `Element` or an integer for the nth frame on the page (zero-based index)

switch-to-other-windowclj

(switch-to-other-window driver)

Given that two and only two browser windows are open, switch to the one not currently active

Given that two and only two browser windows are open, switch to the one not currently active

switch-to-windowclj

(switch-to-window driver handle)

Switch focus to a particular open window

Switch focus to a particular open window

windowclj

(window driver)

Get the only (or first) window

Get the only (or first) window

windowsclj

(windows driver)

Retrieve a vector of Window records which can be used to switch to particular open windows

Retrieve a vector of `Window` records which can be used to switch to particular open windows
sourceraw docstring

key-codeclj

(key-code k)

Representations of pressable keys that aren't text. These are stored in the Unicode PUA (Private Use Area) code points, 0xE000-0xF8FF. Refer to http://www.google.com.au/search?&q=unicode+pua&btnG=Search

Representations of pressable keys that aren't text. These are stored in the Unicode PUA (Private Use Area) code points, 0xE000-0xF8FF. Refer to http://www.google.com.au/search?&q=unicode+pua&btnG=Search
sourceraw docstring

new-driverclj

(new-driver browser-spec)

Start a new Driver instance. The browser-spec can include :browser, :profile, and :cache-spec keys.

The :browser can be one of :firefox, :ie, :chrome, :phantomjs or :htmlunit. The :profile should be an instance of FirefoxProfile you wish to use. The :cache-spec can contain :strategy, :args, :include and/or `:exclude keys. See documentation on caching for more details.

Start a new Driver instance. The `browser-spec` can include `:browser`, `:profile`, and `:cache-spec` keys.

The `:browser` can be one of `:firefox`, `:ie`, `:chrome`, `:phantomjs` or `:htmlunit`.
The `:profile` should be an instance of FirefoxProfile you wish to use.
The `:cache-spec` can contain `:strategy`, `:args`, `:include` and/or `:exclude keys. See documentation on caching for more details.
sourceraw docstring

new-webdrivercljmultimethod

Return a Selenium-WebDriver WebDriver instance, with particularities of each browser supported.

Return a Selenium-WebDriver WebDriver instance, with particularities of each browser supported.
sourceraw docstring

other-window-handles*clj

(other-window-handles* driver)

For consistency with other window handling functions, this starred version just returns the string-based ID's that WebDriver produces

For consistency with other window handling functions, this starred version just returns the string-based ID's that WebDriver produces
sourceraw docstring

phantomjs-enabled?clj

source

rectangleclj

(rectangle element)
source

startclj

(start browser-spec url)

Shortcut to instantiate a driver, navigate to a URL, and return the driver for further use

Shortcut to instantiate a driver, navigate to a URL, and return the driver for further use
sourceraw docstring

webdriver-driversclj

Map of keywords to available WebDriver classes.

Map of keywords to available WebDriver classes.
sourceraw docstring

window-handle*clj

(window-handle* driver)

For WebDriver API compatibility: this simply wraps .getWindowHandle

For WebDriver API compatibility: this simply wraps `.getWindowHandle`
sourceraw docstring

window-handles*clj

(window-handles* driver)

For WebDriver API compatibility: this simply wraps .getWindowHandles

For WebDriver API compatibility: this simply wraps `.getWindowHandles`
sourceraw docstring

with-browsercljmacro

(with-browser & args)

Alias for with-driver

bindings => [name init ...]

Evaluates body in a try expression with names bound to the values of the inits, and a finally clause that calls (.close name) on each name in reverse order.

Alias for with-driver

bindings => [name init ...]

Evaluates body in a try expression with names bound to the values
of the inits, and a finally clause that calls (.close name) on each
name in reverse order.
sourceraw docstring

with-drivercljmacro

(with-driver bindings & body)

bindings => [name init ...]

Evaluates body in a try expression with names bound to the values of the inits, and a finally clause that calls (.close name) on each name in reverse order.

bindings => [name init ...]

Evaluates body in a try expression with names bound to the values
of the inits, and a finally clause that calls (.close name) on each
name in reverse order.
sourceraw docstring

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

× close