Skip to content

Commit

Permalink
add multiple clicks (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uunnamed authored Oct 24, 2020
1 parent ec103c2 commit 012ce9d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/etaoin/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@

;; actions

(declare el->ref)
(declare el->ref wait)

(defn rand-uuid
[]
Expand Down Expand Up @@ -985,6 +985,16 @@
(count elements) q)))
(click-el driver (first elements)))))

(defn click-multi
"Clicks on a multiple elements in batch.
`qs` a vector of [query1 query2 query3 ...]
`pause` a pause between click in seconds, default is 0"

[driver qs & [pause]]
(doseq [q qs]
(wait (or pause 0))
(click driver q)))

;; Double click

Expand Down
6 changes: 6 additions & 0 deletions test/etaoin/api_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
(is (= "rf" default-val))
(is (= "fr" selected-val)))))

(deftest test-multiple-click
(click-multi *driver* [:vehicle1 :vehicle2 :vehicle3] 0.3)
(is (selected? *driver* :vehicle1))
(is (selected? *driver* :vehicle2))
(is (selected? *driver* :vehicle3)))

(deftest test-input
(testing "fill multiple imputs"
(doto *driver*
Expand Down

0 comments on commit 012ce9d

Please sign in to comment.