Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Latest commit

 

History

History
169 lines (100 loc) · 4.08 KB

installation.rst

File metadata and controls

169 lines (100 loc) · 4.08 KB
.. index:: Installation

Installation

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

Prerequisites

.. index:: PhantomJS, Python

Note

.. versionadded:: 1.0

A Ruby version of the casperjs executable is also available in the rubybin/ directory; in order to use the :index:`Ruby` version instead of the Python one:

$ ln -sf `pwd`/rubybin/casperjs /usr/local/bin/casperjs

Or using the ruby interpreter:

$ ruby /path/to/casperjs/rubybin/casperjs
CasperJS version 1.1-DEV at /path/to/casperjs/rubybin/casperjs, using PhantomJS version 1.7.0
...
.. index:: Homebrew

Installing from Homebrew (OSX)

Installation of both PhantomJS and CasperJS can be achieved through Homebrew:

$ brew install casperjs
.. index:: git

Installing from git

Installation can be achieved using git. The code is mainly hosted on Github.

From a stable tag

$ git clone git://github.com/n1k0/casperjs.git
$ cd casperjs
$ git checkout tags/1.0
$ ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs

Once PhantomJS and CasperJS installed on your machine, you should obtain something like this:

$ phantomjs --version
1.7
$ casperjs --version
1.0

From the master branch

The master branch hosts the current development version of CasperJS.

$ git clone git://github.com/n1k0/casperjs.git
$ cd casperjs
$ git checkout master
$ ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs

To check your current installed version:

$ casperjs --version
1.1-DEV

You are now ready to write your :doc:`first script <quickstart>`!

Installing from an archive

You can download tagged archives of CasperJS code:

Latest stable version:

Latest development version (master branch):

Operations are then the same as with a git checkout.

.. index:: Windows

CasperJS on Windows

Phantomjs installation additions

  • Append ";C:\phantomjs" to your PATH environment variable.
  • Modify this path appropriately if you installed PhantomJS to a different location.

Casperjs installation additions

.. versionadded:: 1.0

CasperJS, as of 1.0.0-RC3, ships with a Batch script so you don't need Python nor Ruby to use it.

  • Append ";C:\casperjs\batchbin" to your PATH environment variable.
  • Modify this path appropriately if you installed CasperJS to a different location.

You can now run any regular casper scripts that way:

C:> casperjs.bat myscript.js

Earlier versions of CasperJS

Before 1.0.0-RC3, you had to setup your casper scripts that way:

phantom.casperPath = 'C:\\casperjs-1.1';
phantom.injectJs(phantom.casperPath + '\\bin\\bootstrap.js');

var casper = require('casper').create();

// do stuff

Run the script using the phantom.exe program:

C:> phantomjs.exe myscript.js

Note

There is no output coloration when running CasperJS on Microsoft platforms.

.. index:: Bugs, REPL

Known Bugs & Limitations

  • Due to its asynchronous nature, CasperJS doesn't work well with PhantomJS' REPL.