etaoin

Viktor 2020-06-19T12:01:53.022Z

Trying to set up some scraping on my mac, but ran into some trouble straight away:

(def driver (firefox)) ;; here, a Firefox window should appear
Execution error (NullPointerException) at clj-http.client/json-decode (client.clj:131).
null
                            clojure.core/eval     core.clj: 3214
                                          ...                   
                      clojure.core/partial/fn     core.clj: 2623
                       etaoin.api/boot-driver      api.clj: 2826
                       etaoin.api/boot-driver      api.clj: 2831
                                          ...                   
                    etaoin.api/connect-driver      api.clj: 2762
                    etaoin.api/connect-driver      api.clj: 2786
                                          ...                   
                    etaoin.api/create-session      api.clj:  127
                    etaoin.api/create-session      api.clj:  133
                           etaoin.api/execute      api.clj:  112
                           etaoin.client/call   client.clj:   91
         clj-http.client/wrap-unknown-host/fn   client.clj: 1037
                 clj-http.links/wrap-links/fn    links.clj:   63
             clj-http.cookies/wrap-cookies/fn  cookies.clj:  131
               clj-http.client/wrap-method/fn   client.clj:  884
clj-http.client/wrap-flatten-nested-params/fn   client.clj: 1008
        clj-http.client/wrap-nested-params/fn   client.clj:  984
          clj-http.client/wrap-form-params/fn   client.clj:  950
         clj-http.client/wrap-content-type/fn   client.clj:  709
      clj-http.client/wrap-accept-encoding/fn   client.clj:  748
               clj-http.client/wrap-accept/fn   client.clj:  726
           clj-http.client/wrap-exceptions/fn   client.clj:  249
      clj-http.client/wrap-output-coercion/fn   client.clj:  572
     clj-http.client/output-coercion-response   client.clj:  561
                                          ...                   
                 clj-http.client/eval13379/fn   client.clj:  527
                                          ...                   
             clj-http.client/coerce-json-body   client.clj:  460
             clj-http.client/coerce-json-body   client.clj:  465
             clj-http.client/decode-json-body   client.clj:  457
                                          ...                   
                  clj-http.client/json-decode   client.clj:  127
                  clj-http.client/json-decode   client.clj:  131
                           clojure.core/apply     core.clj:  665
         java.lang.NullPointerException: 
A firefox window does pop up but after this is doesn’t let me do anything with it. Same thing happens with chrome. Does anyone know what I’m doing wrong?

borkdude 2020-06-19T13:05:16.022400Z

maybe cheshire is not on the classpath so it can't decode JSON?

Viktor 2020-06-19T13:23:51.022800Z

Oh yeah that was it! Amazing, thanks a lot @borkdude

borkdude 2020-06-19T13:27:45.023500Z

@viktor.holmberg which is a bit weird since it is a dep of etaoin: https://github.com/igrishaev/etaoin/blob/af6544c5a7fa7fa1c21341636459df59a37b8f9b/project.clj#L27

Viktor 2020-06-19T13:34:14.023800Z

Yeah I saw that, very odd. Must be some mess with the my dependency tree in Leiningen. I will have to look further into it