// tested with casperjs v1.1.0-beta3 and phantomjs v1.9.7 var casper = require('casper').create({ viewportSize: {width: 1024, height: 768} }); casper.start('https://news.ycombinator.com/', function() { this.capture('hackernews-main.pdf'); var links = this.evaluate(function() { var l = document.querySelectorAll("td[class=title] a"); var r = []; for (var i=0; i