Fork me on GitHub
#etaoin
<
2023-11-16
>
emaun22:11:34

In the case where I have a vector of letters ["a" "b" "c"] and I want to algorithmically insert multiple (e/add-key-press %) calls from mapping over the vector. How could I do that using the threaded macro similar to the https://cljdoc.org/d/etaoin/etaoin/1.0.40/doc/user-guide#actions:~:text=Here%E2%80%99s%20a%20slightly%20larger%20working%20annotated%20example%3A? Could I, for example, merge the make-key-input call with a vector of key-presses? Or is the better call to use the https://cljdoc.org/d/etaoin/etaoin/1.0.40/doc/user-guide#actions:~:text=You%20can%20create%20a%20map%20manually%20and%20send%20it%20to%20the%20perform%2Dactions%20method%3A?

emaun22:11:34

A wonky example of what I'm trying to accomplish. 🙂

(let [actions (map (fn [e] 
                  (cond
                   (= (str e) "\b") (conj (e/add-key-press k/backspace))
                   :else (conj (e/add-key-press (str e)))))
               vector-of-letters)
      keyboard (-> (e/make-key-input)
                   (conj actions))]
(e/perform-actions driver keyboard))

lread22:11:09

Hi @U03F0727DV0! I've not played too much with webdriver actions, other than verifying that the examples worked while updating the docs...

lread22:11:32

I am not sure exactly what your goal is (yet). If it is something like Etaoin's fill-human, https://github.com/clj-commons/etaoin/blob/v1.0.40/src/etaoin/api.clj#L2895.