Skip to content

Instantly share code, notes, and snippets.

@HomerJSimpson
Created November 5, 2015 23:49
Show Gist options
  • Save HomerJSimpson/226eece811d729c9f3c7 to your computer and use it in GitHub Desktop.
Save HomerJSimpson/226eece811d729c9f3c7 to your computer and use it in GitHub Desktop.
iterating over list of links with casperjs
casper.then(function() {
href = this.evaluate(function() {
return document.querySelectorAll('a[href*="manageForms"]')[0].href;
});
casper.thenOpen(href, function() {
var iFormsLinks = this.evaluate(function() {
return Array.prototype.slice.call(document.querySelectorAll('td:last-child a:first-child')).map(function(e) {
return e.href;
});
});
this.each(iFormsLinks, function(self, link) {
self.thenOpen(link, function() {
self.waitForSelector("iframe", function() {
screen.shot(link);
});
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment