How to Install CasperJS on Windows

Posted on the 30 March 2015 by Abhishek Somani @somaniabhi
CasperJs is a javascript library written for phantomjs which is a headless browser . To install casperjs in windows , first you need to download phantomjs and set its exe file path in you path environment variable . after that download casperjs for windows , and set its batchbin directory path in your path enviornment variable . You can check your installation by typing phantomjs and casperjs on your command windows . If you do not get 'Unrecognized command error ' then it means your installation is successful . Now you might get following error if you try to run some javascript in casperjs .

Couldn't find nor compute phantom.casperPath, exiting.
To resolve this error , you need to insert following lines in bootsrap.js in your bin directory of casperjs .

var system = require('system');
var argsdeprecated = system.args;
argsdeprecated.shift();
phantom.args = argsdeprecated;
Now , try to run again , and you will not see this error . Ref Post Comments and Suggestions !!