Skip to content

Extracted css-value #39

merged 1 commit into from Feb 6, 2012

3 participants

locopati commented Feb 6, 2012

Pulled .getCssValue into its own function in the IElement protocol
Refactored hover to use css-value instead of .getCssValue

There is no test written for this because I was unable to run lein test successfully. It appears that the server did not startup. Also, though easy to fix, chromedriver needs manual downloading and setup to make tests work. Would love to help find a way to avoid that as it would lower the bar of entry to working with clj-webdriver.

In my testing code, I've been doing something like this...

(defn chromedriver
  "Return the name of the chrome driver to be used. This is based on the os name."
  (str "driver/chromedriver_" (->> (System/getProperty "")
                                   (re-find #"[^ ]*")

(defn start-browser
  "Return a Webdriver. Defaults to Chrome browser."
  ([url] (start-browser url :chrome))
  ([url browser]
     (if (= :chrome browser)
       (System/setProperty "" (chromedriver)))
     (start {:browser browser} url)))

Mind you, that's hard coding chromedriver and it also means including it in the source repo since it's not available on clojars or the maven repo. Agree that that's less than ideal, but I do like that starting the browser automatically configures itself.

@AndyKriger AndyKriger Added css-value to IElement protocol and implementation to Element. R…
…eplaced use of .getCssValue in flash fn with css-value.
semperos commented Feb 6, 2012

I'll address both points.

If I recall correctly, support for .getCssValue() has always been unstable (even mentions it in the API documentation. That said, I obviously use it in my code base, so happy to pull this in.

The ChromeDriver issue is a different can of worms. The "canonical" setup as I understand it is just to download the separate driver and put it on your system's PATH; the ChromeDriver implementation provided by Selenium-WebDriver handles everything else for you. It's an unfortunate extra step, but definitely one at the Selenium-WebDriver level.

@semperos semperos merged commit 8dd2fb5 into semperos:master Feb 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.