Created
July 26, 2014 15:50
-
-
Save gorgogol/8b1572f08d6c620486dc to your computer and use it in GitHub Desktop.
Returns number of google results for search of given term. (example: casperjs --key=java searchGoogle.js) #casperjs
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: "debug" | |
}); | |
var key = casper.cli.options['key']; | |
var url = 'http://www.google.com'; | |
casper.start(url); | |
casper.then(function(){ | |
this.fill("form", {'q': key}, true ); | |
}); | |
casper.then(function(){ | |
this.echo(this.fetchText("#resultStats").match(/\d.*\d/)); | |
}); | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment