ariya.io About Talks Articles

one year of wandering headlessly

3 min read


One year ago I decided to bite the bullet and released PhantomJS to the world. It was the opening move in my own initiative to curate at least three open-source projects. While it was far from being really really ready, I was very content that I didn’t postpone it much further. After all, isn’t worse actually better?

After five stable releases, from the initial 1.0 to the latest Glory of the Snow (all named after flowers, read the full story), PhantomJS gets stronger and gains more traction and momentum. Let’s have a quick review on how people use it.

Since it is essentially a headless version of WebKit, web page automation is the main use cases. For scraping and navigation, CasperJS (which is using PhantomJS) from Nicolas Perriault strikes as an excellent example on how to do this. Check its documentation and examples, most of your automation needs will be probably covered. For automated page analysis, see also James Pearce’s confess.js which you can use (among others) to analyze page speed and cache manifest usage.

Automatic manipulation of browser content is the key to application testing. PhantomJS slowly becomes a common way to run the tests headless in many test frameworks. It is really easy to hook PhantomJS to the testing infrastructure, there are reports people running it with Jasmine, QUnit, FuncUnit, etc. Of course that once it is done, making it part of the workflow with various continuous integration system, anything from TeamCity and Jenkins is rather fun.

Speaking about testing, Capybara is often the choice for Rails/Rack developers. Thanks to Jon Leighton, finally we have Poltergeist, a solid PhantomJS driver for Capybara. While it does not substitute multi-browser testings via Selenium/Web Driver of various real-world browsers, this driver facilitates very fast smoke testing, just to ensure that you don’t do any stupid mistake before launching the extensive browser testing.

In addition, again thanks to Jon’s effort and the cool guys at Travis, PhantomJS is supported as part of your testing for Travis CI. There are already projects which leverage this (again as part of quick automated smoke tests), among others CasperJS and Ember.js (formerly known as SproutCore 2.0).

If you are not still convinced, there is a bunch of companies out there who use PhantomJS internally as part of the application development, from Sencha, Torbit, Betfair, to Time Warner Cable. Last year alone there were more than 80 articles and blog posts showing different use cases. Also, we even have leading company such as KDAB which put engineering effort into improving PhantomJS. And while I can’t reveal the details yet, expect to see more support from commercial organizations to the future development of PhantomJS this year.

The rather simplistic official site phantomjs.org successfully gets more than 120 thousands visits. Thanks to Maurice Svay, the site will sport a fresh redesign very soon. In the mean time, the project page hosted at Google Code easily hits half million views from more than 20 thousands unique visitors. The community discussion happens mainly in the mailing-list which currently grows to more than 300 members.

Technically, PhantomJS also serves as my playground for some of the software development best practices I experiment lately, everything from predictable time-based release schedules to extensive uses of issue tracker (read about it in the previous blog post). If you understand the concept of lean startup, these strategies may sound familiar.

It’s been an extremely fun ride. Thank you PhantomJS users and contributors for the amazing one year. We will not stop here for sure. Welcome to the year of headless dragon!

Related posts:

♡ this article? Explore more articles and follow me Twitter.

Share this on Twitter Facebook