casper_test.js 400 Bytes
phantom.casperPath = 'path/to/node_modules/casperjs';
phantom.injectJs('path/to/node_modules/casperjs/bin/bootstrap.js');
phantom.casperTest = true;
//var casper = require('casper');
var x = require('casper').selectXPath;
casper.start('http://google.com/', function() {
this.echo(this.getTitle());
this.assertExists(x('//*[@id="gbqfbb"]'), 'the element exists');
});
casper.run();