I installed PhantomJS in C:\xampp\htdocs\phantom and also I installed CasperJS in this folder C:\xampp\htdocs\casper
When I tried to run these sample code on casper site using phantomjs test.js
command:
var casper=require('casper').create();
casper.start('http://google.fr/');
casper.thenEvaluate(function(term) {
document.querySelector('input[name="q"]').setAttribute('value', term);
document.querySelector('form[name="f"]').submit();
}, 'CasperJS');
casper.then(function() {
// Click on 1st result link
this.click('h3.r a');
});
casper.then(function() {
console.log('clicked ok, new location is ' + this.getCurrentUrl());
});
casper.run();
It gives me an error telling me that:
Error: Cannot find module 'casper'
What did I do wrong?