      ~@body))
 
 ;;
+;; find elements
+;;
+
+(defmacro with-el [term el & body]
+  `(let [~el (api/find-element *server* *session* *locator* ~term)]
+     ~@body))
+
+(defmacro with-els [term el & body]
+  `(doseq [~el (api/find-elements *server* *session* *locator* ~term)]
+     ~@body))
+
+(defmacro with-el-from [parent term el & body]
+  `(let [~el (api/find-element-from-element *server* *session* ~parent *locator* ~term)]
+     ~@body))
+
+(defmacro with-els-from [el-parent term el & body]
+  `(doseq [~el (api/find-elements-from-element *server* *session* ~el-parent *locator* ~term)]
+     ~@body))
+
+(defn with-el-active [el & body]
+  `(let [~el (api/get-active-element *server* *session*)]
+     ~@body))
+
+;;
 ;; locators
 ;;
 

  (Thread/sleep (* sec 1000)))

(defn wait-for-predicate
  [predicate & {:keys [timeout poll]
                :or {timeout 10 poll 0.5}}]
  (loop [times 0
         time-rest timeout]
    (when (< time-rest 0)
      (throw+ {:type :webdriver/timeout
               :timeout timeout
               :poll poll
               :times times

(defn fill-form-el [el-form form]
  (doseq [[field value] form]
    (let [term (format "//input[@name='%s']" (name field))]
      (with-xpath
        (with-el-from el-form term el-input
          (fill-el el-input (str value)))))))

(defn fill-form [term form]
  (with-el term el-form
    (fill-form-el el-form form)))

(defn submit-form-el [el-form form]
  (fill-form-el el-form form)
  (with-xpath
    (with-el-from el-form "//submit | //button[@type='submit']" el-submit
      (click-el el-submit))))

(defn submit-form [term form]
  (with-el term el-form
    (submit-form-el el-form form)))

(defn clear-form-el [el-form]
  (with-xpath
    (with-els-from el-form "//input[not(@type='hidden')]" el-input
      (clear-el el-input))))

(defn clear-form [term]
  (with-el term el-form
    (clear-form-el el-form)))

(defn get-form-el [el-form]
  (let [term "//input"
