Browse files

Update the README

  • Loading branch information...
1 parent 51c83be commit cf37abe720d3247700e0f2fba977c337f6a5c4fd @jonleighton jonleighton committed Jan 3, 2012
Showing with 70 additions and 5 deletions.
  1. +70 −5
@@ -13,14 +13,55 @@ Add `poltergeist` to your Gemfile, and add in your test setup add:
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
-You will also need PhantomJS 1.3+ on your system.
-[Here's how to do that](
Currently PhantomJS is not 'truly headless', so to run it on a continuous integration
server you will need to use [Xvfb]( You can either use the
[headless gem]( for this,
or make sure that Xvfb is running and the `DISPLAY` environment variable is set.
+## Installing PhantomJS ##
+You need PhantomJS 1.4.1+, built against Qt 4.8, on your system.
+### Mac users ##
+By far the easiest, most reliable thing to do is to [install the
+pre-built static binary](
+Try this first.
+### Linux users, or if the pre-built Mac binary doesn't work ###
+You need to build PhantomJS manually. Unfortunately, this not
+currently straightforward, for two reasons:
+1. Using Poltergeist with PhantomJS built against Qt 4.7 causes
+ segfaults in WebKit's Javascript engine. Fortunately, this problem
+ doesn't occur under the recently released Qt 4.8. But if you don't
+ have Qt 4.8 on your system (check with `qmake --version`), you'll
+ need to build it.
+2. A change in the version of WebKit bundled with Qt 4.8 means that in order
+ to be able to attach files to file `<input>` elements, we must apply
+ a patch to the Qt source tree that PhantomJS is built against.
+So, you basically have two options:
+1. **If you have Qt 4.8 on your system, and don't need to use file
+ inputs**, [follow the standard PhantomJS build instructions](
+2. **Otherwise**, [download the PhantomJS tarball](,
+ `cd deploy/` and run either `./ --qt-4.8` or `./`.
+ The script will
+ download Qt, apply some patches, build it, and then build PhantomJS
+ against the patched build of Qt. It takes quite a while, around 30
+ minutes on a modern computer with two hyperthreaded cores. Afterwards,
+ you should copy the `bin/phantomjs` binary into your `PATH`.
+PhantomJS 1.5 plans to bundle a stripped-down version of Qt, which will
+reduce the build time a bit (although most of the time is spent building
+WebKit) and make it easier to apply patches. When it is possible to make
+static builds for Linux, those may be provided too, so most users will
+avoid having to build it themselves.
## What's supported? ##
Poltergeist supports basically everything that is supported by the stock Selenium driver,
@@ -60,21 +101,45 @@ test setup:
## Bugs ##
Please file bug reports on Github and include example code to reproduce the problem wherever
-possible. (Tests are even better.)
+possible. (Tests are even better.) Please also provide the output with
+`:debug` turned on, and screenshots if you think it's relevant.
## Why not use [capybara-webkit]( ##
If capybara-webkit works for you, then by all means carry on using it.
However, I have had some trouble with it, and Poltergeist basically started
as an experiment to see whether a PhantomJS driver was possible. (It turned out it
-was, but only thanks to some new features in the recent 1.3.0 release.)
+was, but only thanks to some new features since the 1.3 release.)
In the long term, I think having a PhantomJS driver makes sense, because that allows
PhantomJS to concentrate on being an awesome headless browser, while the capybara driver
(Poltergeist) is able to be the minimal amount of glue code necessary to drive the
+I also find it more pleasant to hack in CoffeeScript than C++,
+particularly as my C++ experience only goes as far as trying to make
+PhantomJS/Qt/WebKit work with Poltergeist :)
+## Hacking ##
+Contributions are very welcome and I will happily give commit access to
+anyone who does a few good pull requests.
+To get setup, run `bundle install`. You can run the full test suite with
+`rspec spec/` or `rake`.
+I previously set up the repository on [Travis CI](
+but unfortunately given they need a custom-built Qt+PhantomJS in order
+to pass, it can't be used for now. When static Linux PhantomJS builds
+are working this can be revisited.
+While PhantomJS is capable of compiling and running CoffeeScript code
+directly, I prefer to compile the code myself and distribute that (it
+makes debugging easier). Running `rake autocompile` will watch the
+`.coffee` files for changes, and compile them into
## License ##
Copyright (c) 2011 Jonathan Leighton

0 comments on commit cf37abe

Please sign in to comment.