等到下载完成后再调用clojure中的函数

时间:2015-08-07 21:50:32

标签: java selenium post clojure clojure-java-interop

我使用webdriver导航到网页并下载json文件。我需要等待完成(或者失败,我将向用户发送消息)以便下载文件,然后才能调用将数据输入程序的函数。我可以在clojure或java生态系统中使用哪些东西来实现这一目标吗?

(defn web-driver []
(taxi/set-driver! {:browser :chrome} "https://website.net")
(taxi/quick-fill-submit {"#user_email" "myemail@something.com"}
                      {"#user_password" "password"}
                      {"#user_password" taxi/submit})

(taxi/click "a[href*='/admin/...../export']")
(taxi/wait-until #(taxi/exists? {:xpath"/html/body/....}))
(taxi/click {:xpath "/html/body/...."})
(taxi/click {:xpath "/html/body/...."})
(taxi/click {:xpath "/html/body/...button"}))

(defn find-file []
(let [file-name (for [file (me/list-dir "/Users/.../Downloads")
            :let [s (.toString file)]
            :when (.contains s "Im looking for")] s)]
(apply str file-name)))

所以我想等到我在运行webdriver之后完成下载才能完成调用(find-file)。我正在使用selenium web-driver。

enter image description here

0 个答案:

没有答案