CasperJS is a navigation scripting & testing utility for PhantomJS and SlimerJS written in Javascript

CasperJS is an open source navigation scripting & testing utility written in Javascript for the PhantomJSWebKit headless browser and SlimerJS (Gecko). 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:

Installation

CasperJS can be installed on Mac OSX, Windows and most Linuxes.

Prerequisites

  • PhantomJS 1.8.2 or greater. Installation instructions can be found here
  • Python 2.6 or greater for casperjs in the bin/ directory

New in version 1.1.

  • Experimental: as of 1.1-beta1, SlimerJS 0.8 or greater to run your tests against Gecko (Firefox) instead of Webkit (just add –engine=slimerjs to your command line options). To see PhantomJS API compatibility of SlimerJS, please refer to this page.

 

Installing from Homebrew (OSX)

Installation of both PhantomJS and CasperJS can be achieved using Homebrew, a popular package manager for Mac OS X.

Above all, don’t forget to update Formulaes:

$ brew update

For the 1.1 development version (recommended):

$ brew install casperjs --devel

For the 1.0.x stable version:

$ brew install casperjs

If you have already installed casperjs and want to have the last release (stable|devel), use upgrade:

$ brew upgrade casperjs

Upgrade only update to the latest release branch (1.0.x|1.1-dev).

Installing from npm

New in version 1.1-beta3.

You can install CasperJS using npm:

$ npm install -g casperjs

Note

The -g flag makes the casperjs executable available system-wide.

Warning

While CasperJS is installable via npm, it’s not a NodeJS package, neither it’s capable to require native NodeJS modules.

Installing from git

You can type in terminal :

$ cd /usr/local/share
$ sudo wget https://phantomjs.googlecode.com/files/phantomjs-1.9.0-linux-i686.tar.bz2
$ sudo tar -xjf /usr/local/share/phantomjs-1.9.0-linux-i686.tar.bz2
$ sudo ln -sf /usr/local/share/phantomjs-1.9.0-linux-i686/bin/phantomjs /usr/local/bin/phantomjs
$ phantomjs --version
$ sudo git clone git://github.com/n1k0/casperjs.git /usr/local/src/casperjs
$ cd /usr/local/src/casperjs
$ sudo git checkout tags/1.1-beta3
$ sudo ln -sf /usr/local/src/casperjs/bin/casperjs /usr/local/bin/casperjs
$ casperjs --version

Keep Learn, Have fun Coding!!

Advertisements