Pages

Friday, July 12, 2013

CasperJS & PhantomJS: Headless WebKit with JavaScript API

In addition to Zombie, which proves difficult to use on Windows, here are more options for headless full web stack testing:

PhantomJS: Headless WebKit with JavaScript API: "PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG."

CasperJS is "an open source navigation scripting & testing utility written in Javascript and based on PhantomJS — the scriptable headless WebKit engine. It eases the process of defining a full navigation scenario and provides useful high-level functions, methods & syntactic sugar for doing common tasks such as:

defining & ordering browsing navigation steps
filling & submitting forms
clicking & following links
capturing screenshots of a page (or part of it)
testing remote DOM
logging events
downloading resources, including binary ones
writing functional test suites, saving results as JUnit XML
scraping Web contents"

2 comments:

Imageroller said...

How do you find font rendering in your PhantomJS snapshots?

Alen's Australia said...

Hi, I have not used Phantom in years now. It was taking too much time when something goes wrong. And the cause was oftentimes the browser.
Now looking into trying out headless Firefox.