Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// screenshot.js
var casper = require('casper').create({viewportSize:{width:1600,height:900}});
var args = casper.cli.args;
var imgfile = (args[1] || Math.random().toString(36).slice(2)) + '.png'
casper.start(args[0], function() {
this.captureSelector(imgfile, '.rChart');
});
casper.run();
function makeCasper() {
phantom.casperPath = './phantomcss/CasperJs';
phantom.injectJs(phantom.casperPath + '/bin/bootstrap.js');
phantom.injectJs('jquery.js');
var casper = require('casper').create({
viewportSize: {
width: 1024,
height: 800
}
});
return casper;
}
var casper = require("casper").create();
casper.start('test/fixtures/basicSiteWithImages.html');
casper.then(function() {
this.capture('tmp/test.png');
});
casper.run();
var system = require('system');
var url = system.env['APPLICATION_URL'];
var casper = require('casper').create();
casper.start(url, function() {
this.test.assertTitle('It Work!');
});
casper.run(function() {
this.test.done();
this.test.renderResults(true);
});
var casper = require('casper').create()
casper.start('http://casperjs.org/')
casper.then(function() {
this.echo('First Page: ' + this.getTitle())
})
casper.thenOpen('http://phantomjs.org', function() {
this.echo('Second Page: ' + this.getTitle())
})
casper.run()