We need to do a headless testing of a project using Selenium + PHPUnit for which PhantomJS is a natural choice. However, they currently have a major issue with the recent Selenium Server and no maintainers for the Ghostdriver, not to mention that PhantomJS itself is undergoing pretty significant changes for v2.0. So PhantomJS will not be a viable option for at least a few months.

Is there any solid alternative to this? I've heard of HtmlUnit(Driver) but that seems like a pretty old project with its own issues. Other ideas?

3 Answers 3


Although not a 100% similar alternative, but you could look into running real browsers headless.

Some articles to get you started:


Docker Selenium is an official Docker image that starts a headless selenium grid on your local machine:

Selenium Grid Hub

$ docker run -d -p 4444:4444 --name selenium-hub selenium/hub:2.44.0

Chrome and Firefox Nodes

$ docker run -d --link selenium-hub:hub selenium/node-chrome:2.44.0
$ docker run -d --link selenium-hub:hub selenium/node-firefox:2.44.0

This exposes selenium on localhost:4444, which runs tests headlessly against firefox and chrome.


You might take a look at doing headless testing with Ruby, RSpec, Capybara, Poltergeist and PhantomJS. I find this combination works very well for my purposes--it uses Webkit. It may sound like it would be rough to configure all that, but actually it's not too bad. I have a Dockerfile that presents a rough example here--I'm still new to Docker, so would appreciate feedback if you play with that, as I'd like to make it easy for people to try this stack. If you aren't interested in Docker, the Dockerfile is likely to be clear enough to illustrate how to install all the parts yourself.

It's not PHP, but between RSpec and Capybara you have a nice little DSL for web testing.

  • We need PHP for a couple of reasons, but thanks for the answer anyway. Commented Jan 30, 2015 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.