     [:session *session* :element]
     {:using *locator* :value q}
     resp
-    (-> resp :ELEMENT)))
+    (-> resp :value :ELEMENT)))
 
 (defmacro with-el [q bind & body]
   `(let [~bind (get-el ~q)]
+     ~@body))
+
+(defmulti get-el-from browser-dispatch)
+
+(defmethods get-el-from [:chrome :phantom] [el-parent q]
+  (with-http :post
+    [:session *session* :element el-parent :element]
+    {:using *locator* :value q}
+    resp
+    (-> resp :value :ELEMENT)))
+
+(defmethod get-el-from :firefox [el-parent q]
+  (with-http :post
+    [:session *session* :element el-parent :element]
+    {:using *locator* :value q}
+    resp
+    (-> resp :value first second)))
+
+(defmulti get-els-from browser-dispatch)
+
+(defmethods get-els-from [:chrome :phantom] [el-parent q]
+  (with-http :post
+    [:session *session* :element el-parent :elements]
+    {:using *locator* :value q}
+    resp
+    (->> resp :value (mapv :ELEMENT))))
+
+(defmethod get-els-from :firefox [el-parent q]
+  (with-http :post
+    [:session *session* :element el-parent :elements]
+    {:using *locator* :value q}
+    resp
+    (->> resp :value (mapv (comp second first)))))
+
+(defmacro with-el-from [el-parent q bind & body]
+  `(let [~bind (get-el-from ~el-parent ~q)]
+     ~@body))
+
+(defmacro with-els-from [el-parent q bind & body]
+  `(doseq [~bind (get-els-from ~el-parent ~q)]
      ~@body))
 
 (defn go [url]

     (with-touch
       (touch-move q-to))))

;; tests

(def host "127.0.0.1")
(def port 6666)

(defn fixture-browsers [f]

  ;; "-v"

  (with-proc p [["geckodriver" "--host" host "--port" port "--log" "fatal"]]
    (testing "firefox"
      (with-server {:host host :port port :browser :firefox}
        (f))))

  ;; "--log-path=/Users/ivan/webdriver666.txt"
  ;; "--verbose"

  (with-proc p [["chromedriver"  (str "--port=" port) ]]
    (testing "chrome"
      (with-server {:host host :port port :browser :chrome}
        (f))))

  (with-proc p [["phantomjs" "--webdriver" port]]
    (testing "phantom"
      (with-server {:host host :port port :browser :phantom}
        (f))))

  )

(use-fixtures
  :each
  fixture-browsers)

(deftest test-clear
  (let [url (-> "html/test.html" io/resource str)
        form "//form[@id='submit-test']"
        input "//input[@id='simple-input']"
        submit "//input[@id='simple-submit']"]
    (wait 3)
    ;; (wait-running :message "The server did not start.")
    (with-session
      (go url)
      (wait 1)
      (skip-phantom
       (maximize))

      (wait 1)
      (is 1)
      ;; (testing "simple clear"
      ;;   (with-xpath
      ;;     (fill input "test")
      ;;     (clear input)
      ;;     (click submit)
      ;;     (with-url url
      ;;       (is (str/ends-with? url "?login=&password=&message=")))))
      ;; (testing "form clear"
      ;;   (with-xpath
      ;;     (fill-form form {:login "Ivan"
      ;;                      :password "lalilulelo"
      ;;                      :message "long_text_here"})
      ;;     (clear-form form)
      ;;     (click submit)
      ;;     (with-url url
      ;;       (is (str/ends-with? url "?login=&password=&message=")))))
      )))

  (with-http :post
    [:session *session* :window]
    {:handle handle} _))

(defmulti window-handles browser-dispatch)

