     driver))
 
 (defn connect-driver [driver & [opt]]
-  (wait 2)
+  (wait-running driver)
   (let [session (create-session driver)]
     (swap! driver assoc :session session)
     driver))

(defn wait-has-class [driver q class & [opt]]
  (wait-predicate #(has-class? driver q class) opt))

;;
;; touch
;;

;;
;; predicates
;;

(defn running? [driver]
  (with-exception Throwable false
    (let [{:keys [host port]} @driver
          socket (java.net.Socket. host port)]
      (if (.isConnected socket)
        (do
          (.close socket)
          true)
        false))))

(defn driver? [driver type]
  (= (dispatch-driver driver) type))
