etaoin

grumplet 2022-11-29T13:42:05.875669Z

Anyone seeing this issue when starting a driver? ; Execution error (IllegalArgumentException) at etaoin.api/wait (api.clj:1854). Here’s a repl transcript. Using chrome 107 and its driver and etaoin 1.0.38

clj꞉user꞉> (require '[etaoin.api :as e])
nil
clj꞉user꞉> (e/chrome {:headless false})
; Execution error (IllegalArgumentException) at etaoin.api/wait (api.clj:1854).
; No matching method sleep found taking 1 args
clj꞉user꞉> 

stacktrace
clojure.lang.Reflector/invokeMatchingMethod (Reflector.java:154)
clojure.lang.Reflector/invokeStaticMethod (Reflector.java:332)
etaoin.api/wait (api.clj:1854)
etaoin.api/wait (api.clj:1849)
etaoin.api/wait-predicate (api.clj:1899)
etaoin.api/wait-predicate (api.clj:1870)

grumplet 2022-11-29T13:44:25.700859Z

On OSX 12.6.1 (Monterey)

borkdude 2022-11-29T13:45:02.861819Z

which JVM is this, 19?

grumplet 2022-11-29T13:45:29.976489Z

openjdk version “19” 2022-09-20

grumplet 2022-11-29T13:45:51.358239Z

You guessed right 🙂

borkdude 2022-11-29T13:45:53.039109Z

how did I know! :)

1
lread 2022-11-29T13:45:58.431179Z

Yeah, https://github.com/clj-commons/etaoin/issues/503

lread 2022-11-29T13:46:23.836359Z

I'll fix sometime today probably.

grumplet 2022-11-29T13:46:24.526169Z

Great! Thanks again

grumplet 2022-11-29T13:59:54.940089Z

That would be nice - thank you. Is there a known JVM that avoids the error?

lread 2022-11-29T14:03:13.848749Z

Ya, JDK17 should be fine.

grumplet 2022-11-29T14:03:30.952069Z

hanks

lread 2022-11-29T14:04:02.832679Z

You are most welcome

borkdude 2022-11-29T14:04:10.942679Z

you can also just write (Thread/sleep 1000) yourself?

lread 2022-11-29T14:05:35.424349Z

I think etaoin is waiting internally... so might not be that easy.

👍 1
lread 2022-11-29T14:06:46.623969Z

This, is the 3rd ping on this issue, so I should really get around to addressing in etaoin.

2022-11-29T14:26:55.081329Z

I hit this problem just yesterday, a (big) hack around it for now (if you're just looking to do something quick) is just to redefine wait in the api ns then jump back to your ns, ie:

(in-ns 'etaoin.api)
(defn wait
  "Sleep for `seconds`."
  (#_{:clj-kondo/ignore [:unused-binding]} [driver seconds]
    (wait seconds))
  ([seconds]
   (Thread/sleep ^long (* seconds 1000))))

(in-ns 'your.ns)

borkdude 2022-11-29T14:27:50.132689Z

yep, intern or alter-var-root will also do

2022-11-29T14:30:14.755059Z

oh yeah, that's better