Commit d7d236bd d7d236bdf46dc17f086c92ae10b2d841d54d7bd5 by Nicolas Perriault

updated samples/googlematch.js to use the new casperjs executable

1 parent 11c2f674
...@@ -3,14 +3,12 @@ ...@@ -3,14 +3,12 @@
3 * estimated results each have. 3 * estimated results each have.
4 * 4 *
5 * Usage: 5 * Usage:
6 * $ phantomjs samples/googlematch.js nicolas chuck borris 6 * $ casperjs samples/googlematch.js nicolas chuck borris
7 * nicolas: 69600000 7 * nicolas: 69600000
8 * chuck: 49500000 8 * chuck: 49500000
9 * borris: 2370000 9 * borris: 2370000
10 * winner is "nicolas" with 69600000 results 10 * winner is "nicolas" with 69600000 results
11 */ 11 */
12 phantom.injectJs('casper.js');
13
14 phantom.Casper.extend({ 12 phantom.Casper.extend({
15 fetchScore: function() { 13 fetchScore: function() {
16 return this.evaluate(function() { 14 return this.evaluate(function() {
...@@ -22,12 +20,14 @@ phantom.Casper.extend({ ...@@ -22,12 +20,14 @@ phantom.Casper.extend({
22 20
23 var casper = new phantom.Casper({ 21 var casper = new phantom.Casper({
24 verbose: true 22 verbose: true
25 }), terms = phantom.args, scores = [], i = 0; 23 }), terms = phantom.casperArgs.args, scores = [], i = 0;
26 24
27 if (terms.length < 2) { 25 if (terms.length < 2) {
28 casper.log('usage: phantomjs googlematch.js term1, term2 [, term3]...').exit(); 26 casper.echo('Usage: casperjs googlematch.js term1, term2 [, term3]...').exit();
29 } 27 }
30 28
29 casper.echo('Let the match begin!');
30
31 casper.start("http://google.fr/"); 31 casper.start("http://google.fr/");
32 32
33 casper.each(terms, function(self, term, i) { 33 casper.each(terms, function(self, term, i) {
......