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
.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() {
......