Fork me on GitHub
#etaoin
<
2022-11-07
>
macrobartfast06:11:17

I’m getting an error (posted in thread to this post) after evaluating the following:

(ns findit.core
  (:require [clojure.xml :as xml]
            [taoensso.carmine :as car]
            [etaoin.api :as d]
            [etaoin.keys :as k])
  (:gen-class))

(def driver (d/firefox))

macrobartfast06:11:49

clojure.lang.Compiler$CompilerException: Syntax error macroexpanding at (form-init289461001756958463.clj:9:13). #:clojure.error{:phase :execution, :line 9, :column 13, :source “form-init289461001756958463.clj”} at clojure.lang.Compiler$InvokeExpr.eval (Compiler.java:3707) clojure.lang.Compiler$DefExpr.eval (Compiler.java:457) clojure.lang.Compiler.eval (Compiler.java:7182) clojure.lang.Compiler.eval (Compiler.java:7132) clojure.core$eval.invokeStatic (core.clj:3214) clojure.core$eval.invoke (core.clj:3210) nrepl.middleware.interruptible_eval$evaluate$fn__964$fn__965.invoke (interruptible_eval.clj:87) clojure.lang.AFn.applyToHelper (AFn.java:152) clojure.lang.AFn.applyTo (AFn.java:144) clojure.core$apply.invokeStatic (core.clj:665) clojure.core$with_bindings_STAR_.invokeStatic (core.clj:1973) clojure.core$with_bindings_STAR_.doInvoke (core.clj:1973) clojure.lang.RestFn.invoke (RestFn.java:425) nrepl.middleware.interruptible_eval$evaluate$fn__964.invoke (interruptible_eval.clj:87) clojure.main$repl$read_eval_print__9086$fn__9089.invoke (main.clj:437) clojure.main$repl$read_eval_print__9086.invoke (main.clj:437) clojure.main$repl$fn__9095.invoke (main.clj:458) clojure.main$repl.invokeStatic (main.clj:458) clojure.main$repl.doInvoke (main.clj:368) clojure.lang.RestFn.invoke (RestFn.java:1523) nrepl.middleware.interruptible_eval$evaluate.invokeStatic (interruptible_eval.clj:84) nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:56) nrepl.middleware.interruptible_eval$interruptible_eval$fn__995$fn__999.invoke (interruptible_eval.clj:152) clojure.lang.AFn.run (AFn.java:22) nrepl.middleware.session$session_exec$main_loop__1062$fn__1066.invoke (session.clj:202) nrepl.middleware.session$session_exec$main_loop__1062.invoke (session.clj:201) clojure.lang.AFn.run (AFn.java:22) java.lang.Thread.run (Thread.java:829) Caused by: clojure.lang.ExceptionInfo: throw+: {:response {:value {:error “session not created”, :message “Expected browser binary location, but unable to find binary in default location, no ‘moz:firefoxOptions.binary’ capability provided, and no binary flag set on the command line”, :stacktrace “”}}, :path “session”, :payload {:desiredCapabilities {:loggingPrefs {:browser “ALL”}}}, :method :post, :type :etaoin/http-error, :port 50007, :host “127.0.0.1”, :status 500, :driver {:args (“geckodriver” “--port” 50007), :capabilities {:loggingPrefs {:browser “ALL”}}, :process #object[java.lang.ProcessImpl 0x68a9075d “Process[pid=54375, exitValue=\“not exited\“]”], :locator “xpath”, :type :firefox, :env nil, :port 50007, :host “127.0.0.1”, :url “http://127.0.0.1:50007”}} {:response {:value {:error “session not created”, :message “Expected browser binary location, but unable to find binary in default location, no ‘moz:firefoxOptions.binary’ capability provided, and no binary flag set on the command line”, :stacktrace “”}}, :path “session”, :payload {:desiredCapabilities {:loggingPrefs {:browser “ALL”}}}, :method :post, :type :etaoin/http-error, :port 50007, :host “127.0.0.1", :status 500, :driver {:args (“geckodriver” “--port” 50007), :capabilities {:loggingPrefs {:browser “ALL”}}, :process #object[java.lang.ProcessImpl 0x68a9075d “Process[pid=54375, exitValue=\“not exited\“]”], :locator “xpath”, :type :firefox, :env nil, :port 50007, :host “127.0.0.1”, :url “http://127.0.0.1:50007”}} at slingshot.support$stack_trace.invoke (support.clj:201) etaoin.client$call.invokeStatic (client.clj:103) etaoin.client$call.invoke (client.clj:71) etaoin.api$execute.invokeStatic (api.clj:111) etaoin.api$execute.invoke (api.clj:79) etaoin.api$create_session.invokeStatic (api.clj:135) etaoin.api$create_session.doInvoke (api.clj:126) clojure.lang.RestFn.invoke (RestFn.java:423) etaoin.api$connectdriver.invokeStatic (api.clj:3352) etaoin.api$connectdriver.doInvoke (api.clj:3269) clojure.lang.RestFn.invoke (RestFn.java:423) etaoin.api$boot_driver.invokeStatic (api.clj:3393) etaoin.api$boot_driver.invoke (api.clj:3377) etaoin.api$boot_driver.invokeStatic (api.clj:3388) etaoin.api$boot_driver.invoke (api.clj:3377) clojure.core$partial$fn__5839.invoke (core.clj:2623) clojure.lang.AFn.applyToHelper (AFn.java:152) clojure.lang.RestFn.applyTo (RestFn.java:132) clojure.lang.Compiler$InvokeExpr.eval (Compiler.java:3702) clojure.lang.Compiler$DefExpr.eval (Compiler.java:457) clojure.lang.Compiler.eval (Compiler.java:7182) clojure.lang.Compiler.eval (Compiler.java:7132) clojure.core$eval.invokeStatic (core.clj:3214) clojure.core$eval.invoke (core.clj:3210) nrepl.middleware.interruptible_eval$evaluate$fn__964$fn__965.invoke (interruptible_eval.clj:87) clojure.lang.AFn.applyToHelper (AFn.java:152) clojure.lang.AFn.applyTo (AFn.java:144) clojure.core$apply.invokeStatic (core.clj:665) clojure.core$with_bindings_STAR_.invokeStatic (core.clj:1973) clojure.core$with_bindings_STAR_.doInvoke (core.clj:1973) clojure.lang.RestFn.invoke (RestFn.java:425) nrepl.middleware.interruptible_eval$evaluate$fn__964.invoke (interruptible_eval.clj:87) clojure.main$repl$read_eval_print__9086$fn__9089.invoke (main.clj:437) clojure.main$repl$read_eval_print__9086.invoke (main.clj:437) clojure.main$repl$fn__9095.invoke (main.clj:458) clojure.main$repl.invokeStatic (main.clj:458) clojure.main$repl.doInvoke (main.clj:368) clojure.lang.RestFn.invoke (RestFn.java:1523) nrepl.middleware.interruptible_eval$evaluate.invokeStatic (interruptible_eval.clj:84) nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:56) nrepl.middleware.interruptible_eval$interruptible_eval$fn__995$fn__999.invoke (interruptible_eval.clj:152) clojure.lang.AFn.run (AFn.java:22) nrepl.middleware.session$session_exec$main_loop__1062$fn__1066.invoke (session.clj:202) nrepl.middleware.session$session_exec$main_loop__1062.invoke (session.clj:201) clojure.lang.AFn.run (AFn.java:22) java.lang.Thread.run (Thread.java:829)

macrobartfast06:11:45

geckodriver was installed to /usr/local/bin via brew install geckodriver

macrobartfast06:11:19

this works:

$ geckodriver
1667801104398	geckodriver	INFO	Listening on 127.0.0.1:4444
(although I stopped that before attempting to connect from the repl, and tried it with it running, too, just in case it would work; I also tried it with geckodriver running in this way and specifying :host and :port in the function, but perhaps incorrectly).

macrobartfast06:11:19

/usr/local/bin has

$ ls -al | grep gecko
lrwxr-xr-x    1 fun admin       44 Nov  6 22:31 geckodriver -> ../Cellar/geckodriver/0.32.0/bin/geckodriver
lrwxr-xr-x    1 pluto  admin       38 Nov  6 22:31 wires -> ../Cellar/geckodriver/0.32.0/bin/wires

lread12:11:30

I'll be happy to help you out with this soon @U0X9N9ZK5.

lread13:11:13

Ok I read over the above, it looks to me like geckodriver is having trouble finding the firefox web browser binary.

lread13:11:42

I'm assuming you have Firefox installed?

macrobartfast03:11:31

Thank you for the help! I do… but it is the Firefox Developer Edition… hmmm.

macrobartfast04:11:00

I’ll install the regular one too and see if that helps.

macrobartfast04:11:36

And there we go! It works! You solved the issue… thank you so much! 😀 Apparently, the firefox developer edition does not work for this.

🎉 1
lread05:11:47

Glad you got it going @U0X9N9ZK5. If you really want to test with the Firefox Developer Edition you might try the :path-browser https://cljdoc.org/d/etaoin/etaoin/1.0.38/doc/user-guide#driver-options.

macrobartfast05:11:10

Great idea… I’ll see if I can get that going as well.

lread13:11:53

If you do try it, please do report back and let us know how it went.