Hi,
I am seeing a weird compilation exception on lein repl. Not sure what's going wrong. It would be great if you could point me in the right direction.
; in Repl when I say
(use 'clj-exception.core) ; I see below exception
;
;CompilerException java.lang.IllegalArgumentException:
; No implementation of method: :page-source of protocol: #'clj-webdriver.core/IDriver found for class: clojure.lang.Var$Unbound, compiling:(core.clj:84:30)
;
;However, below line doesn't throw any error
(use 'clj-webdriver.taxi)
;My project.clj
(defproject clj-exception "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[clj-webdriver "0.6.0"]
[org.clojure/data.xml "0.0.7"]
[enlive "1.1.4"]]
; when VM is used, it's better to have headless mode option. Otherwise everything may go wrong!
:jvm-opts ["-Djava.awt.headless=true"])
;core.clj
(ns clj-exception.core
(:use [clojure.java.io])
(:require [net.cgrand.enlive-html :as html]
[clojure.data.xml :as xml]
[clj-webdriver.taxi :as taxi])
(:import (java.io StringReader)))
(def ^:private browser-count (atom 0))
(defn browser-up
"Start up a browser if it's not already started."
[]
(when (= 1 (swap! browser-count inc))
(taxi/set-driver! {:browser :firefox})
(taxi/implicit-wait 60000)))
(defn browser-down
"If this is the last request, shut the browser down."
[& {:keys [force] :or {force false}}]
(when (zero? (swap! browser-count (if force (constantly 0) dec)))
(taxi/quit)))
(def base-url "www.github.com/")
(defn go
([] (go base-url ""))
([path] (go base-url path))
([base-url path]
(taxi/get-url (str base-url path))))
(defn page-html []
(html/html-resource (java.io.StringReader. (taxi/page-source))))
(go)
(go "blog")
(println (page-html))
Thanks for your time.
-Bharat