Created
July 24, 2012 21:51
-
-
Save semperos/3172908 to your computer and use it in GitHub Desktop.
Relation for Element attribute values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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