[ANN] clj-webdriver 0.7.1 Released, Selenium-WebDriver JAR's **Removed**

80 views
Skip to first unread message

semperos

unread,
Aug 6, 2015, 8:50:58 AM8/6/15
to clj-webdriver
tl;dr New version released that removes Selenium-WebDriver dependencies, so you need to add them yourself in your projects.

I've released version 0.7.1 of clj-webdriver[0]. It's passed all of the test suite (locally, on Travis CI[1], and Saucelabs[2]), and I pulled it into a fresh project and manually tested as well.

This version no longer ships with Selenium-WebDriver itself.

Many of the issues in clj-webdriver's issue queue have had to do with old Selenium-WebDriver JAR's that clj-webdriver directly depended on. This has included problems with:

 * ClassNotFoundErrors 
 * Missing methods
 * Browsers misbehaving

Since the Selenium-WebDriver project moves quickly as new browser releases are made and clj-webdriver depends upon what has proven to be a relatively stable public API for that project, a new clj-webdriver release is not needed for each new Selenium-WebDriver one. New releases will now be focused on tracking breaking API changes on the Selenium-WebDriver side and further new features for this library.

You must specify the Selenium-WebDriver JAR's you need in your project.clj or equivalent.

If you don't specify your own Selenium-WebDriver dependencies, you will get a ClassNotFoundError on the first Selenium-WebDriver class that Clojure chances upon. You can look in clj-webdriver's :dev profile in its project.clj[3] for an example.

If your needs are simple, you likely only need to pull in the selenium-java JAR. If you need to utilize a remote driver, you'll need at least selenium-remote-driver and possibly selenium-server if you're starting the server programmatically with clj-webdriver.

If you need PhantomJS support, you'll need to pull in a Ghostdriver JAR. The most up-to-date appears to be [com.codeborne/phantomjsdriver "1.2.1"] if you're using a recent version of PhantomJS. Note that on Mac OSX Yosemite you'll likely need to be using a different PhantomJS binary[4] than the current official one.

No more magic properties file

I've removed code from clj-webdriver that populated a *properties* map based on looking for Clojure or Java properties files on the classpath. I think this is an application-level concern and doesn't belong in clj-webdriver as a library. Only clj-webdriver.firefox/enable-extension relied on its presence, and then only as a fallback, so if you were relying on that fallback behavior, you should make sure you're passing that function the path to your Firefox extension directly.

Next steps

As outlined in a recent post to this group, I'm taking a fresh look at clj-webdriver and rethinking its approach from the ground up. I'm considering removing the use of a "wrapper" map around Selenium-WebDriver's driver and element classes. I'm likely to remove the element caching behavior (clj-webdriver.cache), as it introduces a layer of complexity that, from subsequent testing, does not appear to provide net gains.

I'm also going to be considering a few fundamentally different approaches to how clj-webdriver could make authoring web tests more interesting, concise, and elegant. The Taxi API is almost a cheap trick: use the same API you already have (itself a shell over the Java one), but take out one parameter so the code is a little shorter. This comes at the cost of code duplication, magic state, and making the Taxi API more awkward for use with multiple WebDriver instances.

Look out for breaking--and hopefully interesting--changes in 0.8.0.

Links:

Niels van Klaveren

unread,
Aug 9, 2015, 4:25:22 PM8/9/15
to clj-webdriver
Thanks for the update Daniel, and great to hear you're back in full force. Hardly a day goes by without running some performance tests with your great library.
I wholeheartedly agree on all points you mentioned how you could improve it even more.

After switching to the Taxi API and then back to the default one, I wondered why just using the doto macro wasn't enough to cut back on browser variable use.

(doto browser
    (input-text element-query text)
    (click button))

That way the first parameter isn't needed, and neither is always returning the browser/webdriver from clj-webdriver functions.

For advanced use you could contemplate variants on:
  • -> and ->> macros, with the first parameter always being the browser, and the return value coming second or last
  • The ->as macro with an implicit binding for the browser that always comes first, and a bindable one for the return value of the previous function
I know macros can be tricky, but these are variants on widely used and understood ones, and the macro code is pretty simple.

Example, my code uses a modified wait-until that returns an element instead of the driver, which I need for the next step. Re-querying turns out to be highly problematic due to timing issues in this dynamic JS application.

Anyway, just some suggestions from what I missed most in clj-webdriver. I'm really stoked for the new changes !

Niels

Sean Corfield

unread,
Aug 11, 2015, 7:16:40 PM8/11/15
to clj-we...@googlegroups.com
We upgraded to 0.7.1 and we were able to get Firefox 32 running our test suite which was not working before, so thank you for that.

We still can’t run the test suite with Chrome but that’s a known issue with Chrome 44 and chromedriver 2.16!

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood


--
You received this message because you are subscribed to the Google Groups "clj-webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clj-webdrive...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

semperos

unread,
Aug 11, 2015, 9:41:22 PM8/11/15
to clj-webdriver
We upgraded to 0.7.1 and we were able to get Firefox 32 running our test suite which was not working before, so thank you for that.

Thanks for verifying that 0.7.1 works for you. Thankfully I'm no longer the blocker on any other solved or unsolved browser compatibility issues :)
Reply all
Reply to author
Forward
0 new messages