Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Make select-related functions return Element records instead of raw J…
Browse files Browse the repository at this point in the history
…ava WebElement objects
  • Loading branch information
semperos committed Feb 8, 2012
1 parent 1be62ba commit daad6d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/clj_webdriver/core_element.clj
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@
;; TODO: test coverage
(all-options [element]
(let [select-list (Select. (:webelement element))]
(lazy-seq (.getOptions select-list))))
(lazy-seq (init-elements (.getOptions select-list)))))

;; TODO: test coverage
(all-selected-options [element]
(let [select-list (Select. (:webelement element))]
(lazy-seq (.getAllSelectedOptions select-list))))
(lazy-seq (init-elements (.getAllSelectedOptions select-list)))))

;; TODO: test coverage
(deselect-option [element attr-val]
Expand Down Expand Up @@ -188,7 +188,7 @@
;; TODO: test coverage
(first-selected-option [element]
(let [select-list (Select. (:webelement element))]
(.getFirstSelectedOption select-list)))
(init-element (.getFirstSelectedOption select-list))))

;; TODO: test coverage
(multiple? [element]
Expand Down
6 changes: 6 additions & 0 deletions src/clj_webdriver/element.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
([] (Element. nil))
([webelement] (Element. webelement)))

(defn init-elements
"Given WebElement objects, batch initialize elements (for things like returning all options for select lists)"
[webelements]
(for [webel webelements]
(init-element webel)))

(defn is-element?
"Return true if parameter is an Element record"
[element]
Expand Down

0 comments on commit daad6d8

Please sign in to comment.