etaoin 2024-12-05

Separate question. In etaoin 1.1.41 a bunch of functions were removed because "there is a viable w3c alternative". I was using a bunch of these, notably (mouse-move-to). I'm fine to implement them in my code if I need to, but it's not really clear how to do so. Should I be using (e/execute) or something? https://github.com/clj-commons/etaoin/issues/467#issuecomment-2278619458

Hey @timgilbert, I'll need to reboot my brain on Etaoin, it has been a while... but W3C moved to https://www.w3.org/TR/webdriver/#actions which Etaoin exposes as https://cljdoc.org/d/etaoin/etaoin/1.1.42/api/etaoin.api?q=perf#perform-actions. Not at REPL at the moment, but maybe https://cljdoc.org/d/etaoin/etaoin/1.1.42/api/etaoin.api?q=scroll#scroll-query could also work for you?

Thanks! I think I figured out how to get (perform-actions) to do what I want, just testing it now

What I've got is this:

(defn mouse-move-to
  "Move the mouse pointer to either a queried element or an x/y coordinate"
  ([d el-query]
   (let [mouse (e/add-pointer-move-to-el (e/make-mouse-input) el-query)]
     (e/perform-actions d mouse)))
  ([d x-coord y-coord]
   (let [mouse (e/add-pointer-move (e/make-mouse-input)
                                   :origin "viewport"
                                   :x x-coord
                                   :y y-coord)]

Oh, good! I think the user guide could use some love around how to use actions. It goes into a complex multi-input case without covering basic use cases.

Yeah, I'll put up a PR to add an example or two once I get some time (probably next week)