Created
March 19, 2014 21:36
-
-
Save fusspawn/9651917 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var casper = require('casper').create({ | |
logLevel: 'info', | |
verbose: true, | |
}); | |
casper.on("remote.message", function(msg) { | |
casper.log(msg.toString(), "info"); | |
}); | |
casper.start('http://codecombat.com/play/ladder/dungeon-arena'); | |
casper.wait(20000 * 1, function() { | |
this.echo("Waiting for cloudflare checks"); // I was hitting the "Cloudflare is checking your browser" | |
}); | |
casper.thenEvaluate(function(term) { | |
$("button[data-target='modal/login']").click(); | |
$("#login-email").val("<myemail>"); | |
$("#login-password").val("<mypass>"); | |
$("#login-button").click(); | |
console.log("Submitted Login"); | |
}, 'CasperJS'); | |
casper.then(function() { | |
this.capture('01.jpg', undefined, { | |
format: 'jpg', | |
quality: 75 | |
}); | |
}); | |
casper.thenEvaluate(function(term) { | |
$('a[href="#simulate"]').click(); | |
}, "CasperJS"); | |
casper.then(function() { | |
this.capture('02.jpg', undefined, { | |
format: 'jpg', | |
quality: 75 | |
}); | |
}); | |
casper.thenEvaluate(function(term) { | |
$("#simulate-button").click(); | |
}, "CasperJS"); | |
casper.then(function() { | |
this.capture('03.jpg', undefined, { | |
format: 'jpg', | |
quality: 75 | |
}); | |
}); | |
casper.wait(30000, function() { | |
this.echo("I've waited for 30seconds"); | |
}); | |
casper.wait(60000 * 60, function() { | |
this.echo("Ran for an hour"); | |
}); | |
casper.then(function() { | |
this.capture('05.jpg', undefined, { | |
format: 'jpg', | |
quality: 75 | |
}); | |
}); | |
casper.run(); | |
// OUTPUT | |
[info] [phantom] Starting... | |
[info] [phantom] Running suite: 12 steps | |
[info] [phantom] Step _step 3/12 http://codecombat.com/play/ladder/dungeon-arena (HTTP 200) | |
[info] [phantom] Step _step 3/12: done in 5563ms. | |
[info] [phantom] wait() finished waiting for 20000ms. | |
Waiting for cloudflare checks | |
[info] [phantom] Step _step 4/12 http://codecombat.com/play/ladder/dungeon-arena (HTTP 200) | |
[info] [phantom] Submitted Login | |
[info] [phantom] Step _step 4/12: done in 25704ms. | |
[info] [phantom] Unsafe JavaScript attempt to access frame with URL http://codecombat.com/play/ladder/dungeon-arena from frame with URL https://apis.google.com/_/widget/render/signin?usegapi=1&clientid=800329290710-j9sivplv2gpcdgkrsis9rff3o417mlfa.apps.googleusercontent.com&cookiepolicy=single_host_origin&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.login%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&size=medium&origin=http%3A%2F%2Fcodecombat.com&url=http%3A%2F%2Fcodecombat.com%2Fplay%2Fladder%2Fdungeon-arena&gsrc=3p&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en_GB.meG8K-jcWN8.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Fz%3Dzcms%2Frs%3DAItRSTPlVRG-apw2rgpm5dmWoLPjEtnx8Q#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh%2Conauth&id=I1_1395264873761&parent=http%3A%2F%2Fcodecombat.com&pfname=&rpctoken=24153539. Domains, protocols and ports must match. | |
[info] [phantom] Unsafe JavaScript attempt to access frame with URL http://codecombat.com/play/ladder/dungeon-arena from frame with URL https://apis.google.com/_/widget/render/signin?usegapi=1&clientid=800329290710-j9sivplv2gpcdgkrsis9rff3o417mlfa.apps.googleusercontent.com&cookiepolicy=single_host_origin&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.login%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&size=medium&origin=http%3A%2F%2Fcodecombat.com&url=http%3A%2F%2Fcodecombat.com%2Fplay%2Fladder%2Fdungeon-arena&gsrc=3p&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en_GB.meG8K-jcWN8.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Fz%3Dzcms%2Frs%3DAItRSTPlVRG-apw2rgpm5dmWoLPjEtnx8Q#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh%2Conauth&id=I1_1395264873761&parent=http%3A%2F%2Fcodecombat.com&pfname=&rpctoken=24153539. Domains, protocols and ports must match. | |
[info] [phantom] Unsafe JavaScript attempt to access frame with URL http://codecombat.com/play/ladder/dungeon-arena from frame with URL https://apis.google.com/_/widget/render/signin?usegapi=1&clientid=800329290710-j9sivplv2gpcdgkrsis9rff3o417mlfa.apps.googleusercontent.com&cookiepolicy=single_host_origin&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.login%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&size=medium&origin=http%3A%2F%2Fcodecombat.com&url=http%3A%2F%2Fcodecombat.com%2Fplay%2Fladder%2Fdungeon-arena&gsrc=3p&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en_GB.meG8K-jcWN8.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Fz%3Dzcms%2Frs%3DAItRSTPlVRG-apw2rgpm5dmWoLPjEtnx8Q#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh%2Conauth&id=I1_1395264873761&parent=http%3A%2F%2Fcodecombat.com&pfname=&rpctoken=24153539. Domains, protocols and ports must match. | |
[info] [phantom] Step anonymous 5/12 http://codecombat.com/play/ladder/dungeon-arena (HTTP 200) | |
[info] [phantom] Capture saved to E:/phantomjs/01.jpg | |
[info] [phantom] Step anonymous 5/12: done in 26708ms. | |
[info] [phantom] Step _step 6/12 http://codecombat.com/play/ladder/dungeon-arena (HTTP 200) | |
[info] [phantom] Step _step 6/12: done in 33562ms. | |
[info] [phantom] Step anonymous 7/12 http://codecombat.com/play/ladder/dungeon-arena (HTTP 200) | |
[info] [phantom] Capture saved to E:/phantomjs/02.jpg | |
[info] [phantom] Step anonymous 7/12: done in 34123ms. | |
[info] [phantom] Step _step 8/12 http://codecombat.com/play/ladder/dungeon-arena (HTTP 200) | |
[info] [phantom] Step _step 8/12: done in 34305ms. | |
[info] [phantom] Step anonymous 9/12 http://codecombat.com/play/ladder/dungeon-arena (HTTP 200) | |
[info] [phantom] Capture saved to E:/phantomjs/03.jpg | |
[info] [phantom] Step anonymous 9/12: done in 34464ms. | |
[info] [phantom] Simulating sessions [object Object],[object Object] | |
[info] [phantom] Step _step 10/12 http://codecombat.com/play/ladder/dungeon-arena (HTTP 200) | |
[info] [phantom] Step _step 10/12: done in 34547ms. | |
[info] [phantom] wait() finished waiting for 30000ms. | |
I've waited for 30seconds | |
[info] [phantom] Step _step 11/12 http://codecombat.com/play/ladder/dungeon-arena (HTTP 200) | |
[info] [phantom] Step _step 11/12: done in 64570ms. | |
[info] [phantom] TypeError: 'undefined' is not a function (evaluating 'Array.prototype.slice.call.bind(Array.prototype.slice)') | |
[info] [phantom] Posted 1 error to errorception.com | |
[info] [phantom] TypeError: 'undefined' is not a function (evaluating 'Array.prototype.slice.call.bind(Array.prototype.slice)') | |
[info] [phantom] Posted 1 error to errorception.com | |
[info] [phantom] Worker Krieger hadn't even loaded the scripts yet after 7500 ms. | |
[info] [phantom] Worker Krieger hadn't even loaded the scripts yet after 7500 ms. | |
[info] [phantom] Worker Krieger hadn't even loaded the scripts yet after 7500 ms. | |
[info] [phantom] Worker Krieger hadn't even loaded the scripts yet after 7500 ms. | |
^ this goes on forever |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment