(attr element attribute)
Return the value of attribute
for element
Return the value of `attribute` for `element`
(clear-text! element)
Clear the current text of text-entry element
. Used with send-text! to manipulate form fields.
Clear the current text of text-entry `element`. Used with send-text! to manipulate form fields.
(click! element)
Send a browser click event to element
.
Send a browser click event to `element`.
(click-all! elements)
Click every element in the sequence elements
. Returns the number of elements clicked.
Click every element in the sequence `elements`. Returns the number of elements clicked.
(css-value element property)
Return the value of CSS property
for element
Return the value of CSS `property` for `element`
(displayed? element)
Is this element displayed or not? This method avoids the problem of having to parse an element's CSS.
Is this element displayed or not? This method avoids the problem of having to parse an element's CSS.
(enabled? element)
Is the element currently enabled or not? This will generally return true for everything but disabled input elements.
Is the element currently enabled or not? This will generally return true for everything but disabled input elements.
(find-by-class browser-or-elem class)
Return the first element with class name class
that's a child of browser-or-elem
(which can be a browser or element). Throws an exception if there's no such element! If called with retry-fn bound - for example by using the with-retry
macro - will wrap the operation in that function.
Return the first element with class name `class` that's a child of `browser-or-elem` (which can be a browser or element). Throws an exception if there's no such element! If called with *retry-fn* bound - for example by using the `with-retry` macro - will wrap the operation in that function.
(find-by-class* browser-or-elem class)
Return all elements with class name class
that are children of browser-or-elem
(which can be a browser or element) or an empty sequence. If called with retry-fn bound - for example by using the with-retry
macro - will wrap the operation in that function.
Return all elements with class name `class` that are children of `browser-or-elem` (which can be a browser or element) or an empty sequence. If called with *retry-fn* bound - for example by using the `with-retry` macro - will wrap the operation in that function.
(find-by-css browser-or-elem css-selector)
Return the first element that matches css-selector
, starting from browser-or-elem
(which can be a browser or element). Throws an exception if there's no such element! If called with retry-fn bound - for example by using the with-retry
macro - will wrap the operation in that function.
Return the first element that matches `css-selector`, starting from `browser-or-elem` (which can be a browser or element). Throws an exception if there's no such element! If called with *retry-fn* bound - for example by using the `with-retry` macro - will wrap the operation in that function.
(find-by-css* browser-or-elem css-selector)
Return all elements that match css-selector
, starting from browser-or-elem
(which can be a browser or element) or an empty sequence. If called with retry-fn bound - for example by using the with-retry
macro - will wrap the operation in that function.
Return all elements that match `css-selector`, starting from `browser-or-elem` (which can be a browser or element) or an empty sequence. If called with *retry-fn* bound - for example by using the `with-retry` macro - will wrap the operation in that function.
(find-by-id browser-or-elem id)
Return the single element with id
that's a child of browser-or-elem
(which can be a browser or element). Throws an exception if there's no such element! If called with retry-fn bound - for example by using the with-retry
macro - will wrap the operation in that function.
Return the single element with `id` that's a child of `browser-or-elem` (which can be a browser or element). Throws an exception if there's no such element! If called with *retry-fn* bound - for example by using the `with-retry` macro - will wrap the operation in that function.
(find-by-tag browser-or-elem tag)
Return the first element with tag name tag
that's a child of browser-or-elem
(which can be a browser or element). Throws an exception if there's no such element! If called with retry-fn bound - for example by using the with-retry
macro - will wrap the operation in that function.
Return the first element with tag name `tag` that's a child of `browser-or-elem` (which can be a browser or element). Throws an exception if there's no such element! If called with *retry-fn* bound - for example by using the `with-retry` macro - will wrap the operation in that function.
(find-by-tag* browser-or-elem tag)
Return all elements with tag name tag
that are children of browser-or-elem
(which can be a browser or element) or an empty sequence. If called with retry-fn bound - for example by using the with-retry
macro - will wrap the operation in that function.
Return all elements with tag name `tag` that are children of `browser-or-elem` (which can be a browser or element) or an empty sequence. If called with *retry-fn* bound - for example by using the `with-retry` macro - will wrap the operation in that function.
(find-by-xpath browser-or-elem xpath)
Return the first element that matches xpath
, starting from browser-or-elem
(which can be a browser or element). Throws an exception if there's no such element! If called with retry-fn bound - for example by using the with-retry
macro - will wrap the operation in that function.
For example:
(with-browser [browser (make-browser)]
(-> (fetch! browser "http://clojure.org")
(find-by-xpath* "//div[@class='clj-intro-message']/p")
(nth 2)
text))
;;=> "I hope you find Clojure's combination of facilities elegant, powerful, practical and fun to use."
Return the first element that matches `xpath`, starting from `browser-or-elem` (which can be a browser or element). Throws an exception if there's no such element! If called with *retry-fn* bound - for example by using the `with-retry` macro - will wrap the operation in that function. For example: ``` (with-browser [browser (make-browser)] (-> (fetch! browser "http://clojure.org") (find-by-xpath* "//div[@class='clj-intro-message']/p") (nth 2) text)) ;;=> "I hope you find Clojure's combination of facilities elegant, powerful, practical and fun to use." ```
(find-by-xpath* browser-or-elem xpath)
Return all elements that match xpath
, starting from browser-or-elem
(which can be a browser or element) or an empty sequence. If called with retry-fn bound - for example by using the with-retry
macro - will wrap the operation in that function.
Return all elements that match `xpath`, starting from `browser-or-elem` (which can be a browser or element) or an empty sequence. If called with *retry-fn* bound - for example by using the `with-retry` macro - will wrap the operation in that function.
(id element)
Return the value of the id attribute of element
Return the value of the id attribute of `element`
(inner-html element)
Return the innerHTML of element
Return the innerHTML of `element`
(location element)
Location on the page of the top left-hand corner of the rendered element.
Location on the page of the top left-hand corner of the rendered element.
(outer-html element)
Return the outerHTML of element
Return the outerHTML of `element`
(rectangle element)
The location and size of the rendered element.
The location and size of the rendered element.
(screenshot browser)
Takes a screenshot of browser
's current state and stores the image in a temporary file, then returns the file's absolute path.
(N.B. this function is in the element namespace because it should take a browser or an element, but there's presently an upstream bug preventing this from working.)
Takes a screenshot of `browser`'s current state and stores the image in a temporary file, then returns the file's absolute path. (N.B. this function is in the element namespace because it should take a browser or an element, but there's presently an [upstream bug](https://github.com/jackrusher/sparkledriver/issues/12) preventing this from working.)
(selected? element)
Return whether or not this element is selected
Return whether or not this element is selected
(send-text! element text)
Send the string text
to element
, as if the user typed it.
Send the string `text` to `element`, as if the user typed it.
(size element)
What is the width and height of the rendered element?
What is the width and height of the rendered element?
(submit-form! element)
Submit element
, which should be an HTML form.
Submit `element`, which should be an HTML form.
(tag element)
Return the tag name of element
Return the tag name of `element`
(text element)
Return the complete visible textual content of element
(including any children). Text from hidden elements is not included.
Return the complete visible textual content of `element` (including any children). Text from hidden elements is not included.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close