Skip to content

Instantly share code, notes, and snippets.

@semperos
Created July 24, 2012 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save semperos/3172908 to your computer and use it in GitHub Desktop.
Save semperos/3172908 to your computer and use it in GitHub Desktop.
Relation for Element attribute values
(use 'clojure.core.logic)
(require '[clj-webdriver.core :as wd])
(defn attributeo
"A relation where `elem` has value `value` for its `attr` attribute"
[driver elem attr value]
(fn [a]
(to-stream
(->> (for [el (wd/find-elements driver *search-domain*)
:let [attribute (keyword attr)]]
(unify a
[elem attr value]
[el attribute (wd/attribute el attribute)]))
(remove not)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment