Running the simplest of casperjs examples gives me an error:
casper.start('http://casperjs.org/', function() {
^
TypeError: Object function (req, res) {
var raw = new Model(data || (allowBody ? req.body : {}));
raw.save(cb || function (err, obj) {
if (err) return res.jsonp(500, err);
res.jsonp(obj);
});
} has no method 'start'
at Object.<anonymous> (/Users/path/to/main.js:16:8)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
The code I am running is:
var utils = require('utils');
var casper = require('casper').create();
casper.start('http://casperjs.org/', function() {
this.echo(this.getTitle());
});
casper.thenOpen('http://phantomjs.org', function() {
this.echo(this.getTitle());
});
casper.run();
Node:js version - v0.10.22 CasperJS version 1.1.0-beta3 at /usr/local/lib/node_modules/casperjs, using phantomjs version 1.9.2 Host OS is OSX 10.8.5
From the CasperJS FAQ:
Is CasperJS a node.js library? No. CasperJS is written on top of PhantomJS, which is a node-independent Qt/WebKit based library. If you try to run your CasperJS script with node, it just won’t work out of the box.
Hint: If you want to drive CasperJS from node, try SpookyJS.
Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With