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
.echo("Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>")
.exit(1)
casper.start "https://twitter.com/#!/#{twitterAccount}", ->
@waitForSelector ".tweet-row", (->
casper.start "https://twitter.com/#{twitterAccount}", ->
@waitForSelector ".stream-container", (->
@captureSelector filename, "html"
@echo "Saved screenshot of #{@getCurrentUrl()} to #{filename}"
), (->
......
......@@ -3,7 +3,7 @@
/**
* This script will capture a screenshot of a twitter account page
* Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>
* Usage: $ casperjs screenshot.js <twitter-account> <filename.[jpg|png|pdf]>
*/
var casper = require("casper").create({
......@@ -18,13 +18,13 @@ var filename = casper.cli.get(1);
if (!twitterAccount || !filename || !/\.(png|jpg|pdf)$/i.test(filename)) {
casper
.echo("Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>")
.echo("Usage: $ casperjs screenshot.js <twitter-account> <filename.[jpg|png|pdf]>")
.exit(1)
;
}
casper.start("https://twitter.com/#!/" + twitterAccount, function() {
this.waitForSelector(".tweet-row", (function() {
casper.start("https://twitter.com/" + twitterAccount, function() {
this.waitForSelector(".stream-container", (function() {
this.captureSelector(filename, "html");
this.echo("Saved screenshot of " + (this.getCurrentUrl()) + " to " + filename);
}), (function() {
......