Skip to content

Instantly share code, notes, and snippets.

@Halleck45
Forked from devosc/phpmetrics.js
Last active December 1, 2015 12:29
Show Gist options
  • Save Halleck45/c205ddff88643f3ba51d to your computer and use it in GitHub Desktop.
Save Halleck45/c205ddff88643f3ba51d to your computer and use it in GitHub Desktop.
//http://slimerjs.org/
var page = require('webpage').create();
page.viewportSize = { width:1280, height:800 };
page.open('http://localhost/phpmetrics.html')
.then(function(){
window.setTimeout(function() {
page.clipRect = { top: 212, left: 55, width: 300, height: 280 };
page.render('build/logs/phpmetrics-maintainability.png');
page.clipRect = { top: 210, left: 400, width: 300, height: 275 };
page.render('build/logs/phpmetrics-custom.png');
page.clipRect = { top: 255, left: 750, width: 300, height: 275 };
page.render('build/logs/phpmetrics-abstractness.png');
page.evaluate(function () {
return document.querySelector("#link-score a").click();
});
window.setTimeout(function() {
page.clipRect = {top: 170, left: 65, width: 560, height: 560};
page.render('build/logs/phpmetrics-evaluation.png');
page.clipRect = {top: 315, left: 645, width: 560, height: 200};
page.render('build/logs/phpmetrics-evaluation-report.png');
page.close();
phantom.exit();
},
3000);
},
3000);
})
@mickaelandrieu
Copy link

phantom.exit(); won't work with phantomjs: how about use CasperJs instead ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment