Commit 34afc8d8 34afc8d88c4201de2f875dda0ad7a66e6db84737 by Nicolas Perriault

Merge pull request #359 from Narno/master

Fixed Twitter URL and selector in samples/screenshot(.js|.coffee)
2 parents 33e0f6ce f2d4dd2d
...@@ -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() {
......