Saturday, December 22, 2012

Clojure, Selenium-WebDriver, and PhantomJS

The following is a small manual of how to setup PhantomJS and use it from Clojure via clj-webdriver  - Clojure API for Selenium-WebDriver.


1. Start a new project using Leiningen:

2. Download PhantomJS from http://phantomjs.org/download.html and unpack it into your project's directory:

3. Now add the following to your project.clj file:


By the way, there is an awesome Leiningen plugin that checks if your dependencies are up to date.

4. Tell Leiningen to update dependencies:

5. Now let's start a REPL to check if everything's in its right place:

Hope it works! If not, ping me and I'll update the tutorial.

10 comments:

Paul Crowley said...

Yes, this works for me - and I had some trouble working out how to plug ghostdriver into Clojure tests until I found this, so many thanks! Sadly our tests, which pass with chromedriver, don't pass with ghostdriver, so some investigation remains to be done, but nonetheless many thanks!

Hans-J. Schmid said...

This is frigging awesome!!! Thanks for the info!!!

bluegray said...

This works great! Is it possible to take a full screen screenshot?

Anonymous said...

for windows curl the windows binary
and replace in the project.clj

:jvm-opts ["-Dphantomjs.binary.path=./phantomjs-1.9.8-windows/phantomjs.exe"]

TheMesaMilieu said...

Great stuff, thanks for this post!

RS Trainings said...

This is a great article man, thanks for the tips! It’s refreshing to learn so many new ways to kick off blog posts.

best online MSBI training
online abinitio training in usa,uk,india,canada
selenium training
best R programming online training
SAP HANA online training in india

Praveen Kumar said...

Valuable information thanks for sharing Selenium Online Training

santhosh kumar said...

good information thanks for sharing it
Selenium Training in Chennai

Logavani G said...

really you have post an informative blog. really it will be helpful to the peoples who are all working in this technology. thank you for sharing this blog.
selenium training in chennai

mellbahenry said...

I am following your blog from the beginning, i gathered lot of information from your post. and also i would like to suggest your blog to my friends. Thank you. Software Testing Training in Chennai
Software Testing Training in Chennai