Created
February 10, 2014 20:45
-
-
Save jbnicolai/8923825 to your computer and use it in GitHub Desktop.
CasperJS crawler and user info fetcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var casper = require('casper').create({ verbose: true, logLevel: 'info' }); | |
var credentials = JSON.parse(require('fs').read('./credentials.json')); | |
var url = 'private'; | |
casper.start(url + '/user/login', function() { | |
this.fill('form#login_form', credentials, true); | |
}); | |
casper.thenOpen(url + '/subscription/config/xebia.com/exchange_mailbox', function() { | |
this.getElementsInfo('tr td a').forEach(function (node) { | |
if (node.attributes.nicetitle === "View") { | |
casper.thenOpen(url + node.attributes.href, function() { | |
require('fs').write('output', JSON.stringify(this.getElementInfo('div.contentleft').html, 'a')); | |
}); | |
} | |
}); | |
}); | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment