Commit 25022393 25022393ef83aa08c3acfa5bd024ccba11905a47 by Nicolas Perriault

Merge pull request #359 from Narno/master

Fixed Twitter URL and selector in samples/screenshot(.js|.coffee)
1 parent 4814a10b
...@@ -16,8 +16,8 @@ if not twitterAccount or not filename or not /\.(png|jpg|pdf)$/i.test filename ...@@ -16,8 +16,8 @@ if not twitterAccount or not filename or not /\.(png|jpg|pdf)$/i.test filename
16 .echo("Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>") 16 .echo("Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>")
17 .exit(1) 17 .exit(1)
18 18
19 casper.start "https://twitter.com/#!/#{twitterAccount}", -> 19 casper.start "https://twitter.com/#{twitterAccount}", ->
20 @waitForSelector ".tweet-row", (-> 20 @waitForSelector ".stream-container", (->
21 @captureSelector filename, "html" 21 @captureSelector filename, "html"
22 @echo "Saved screenshot of #{@getCurrentUrl()} to #{filename}" 22 @echo "Saved screenshot of #{@getCurrentUrl()} to #{filename}"
23 ), (-> 23 ), (->
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
3 3
4 /** 4 /**
5 * This script will capture a screenshot of a twitter account page 5 * This script will capture a screenshot of a twitter account page
6 * Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]> 6 * Usage: $ casperjs screenshot.js <twitter-account> <filename.[jpg|png|pdf]>
7 */ 7 */
8 8
9 var casper = require("casper").create({ 9 var casper = require("casper").create({
...@@ -18,13 +18,13 @@ var filename = casper.cli.get(1); ...@@ -18,13 +18,13 @@ var filename = casper.cli.get(1);
18 18
19 if (!twitterAccount || !filename || !/\.(png|jpg|pdf)$/i.test(filename)) { 19 if (!twitterAccount || !filename || !/\.(png|jpg|pdf)$/i.test(filename)) {
20 casper 20 casper
21 .echo("Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>") 21 .echo("Usage: $ casperjs screenshot.js <twitter-account> <filename.[jpg|png|pdf]>")
22 .exit(1) 22 .exit(1)
23 ; 23 ;
24 } 24 }
25 25
26 casper.start("https://twitter.com/#!/" + twitterAccount, function() { 26 casper.start("https://twitter.com/" + twitterAccount, function() {
27 this.waitForSelector(".tweet-row", (function() { 27 this.waitForSelector(".stream-container", (function() {
28 this.captureSelector(filename, "html"); 28 this.captureSelector(filename, "html");
29 this.echo("Saved screenshot of " + (this.getCurrentUrl()) + " to " + filename); 29 this.echo("Saved screenshot of " + (this.getCurrentUrl()) + " to " + filename);
30 }), (function() { 30 }), (function() {
......