diff options
| author | yo mama <pepper@scannerjammer.com> | 2015-05-17 14:51:09 -0700 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2015-05-17 14:51:09 -0700 |
| commit | 32535584842fe1d53e04693a91e50c9108db3d47 (patch) | |
| tree | 056276794bbf1917dfcbdf85e4a21017933d9065 /facebook_casper.js | |
Diffstat (limited to 'facebook_casper.js')
| -rw-r--r-- | facebook_casper.js | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/facebook_casper.js b/facebook_casper.js new file mode 100644 index 0000000..1f5c4e0 --- /dev/null +++ b/facebook_casper.js @@ -0,0 +1,103 @@ +var utils = require('utils'); +var fs = require('fs'); +var casper = require('casper').create({ +verbose: true, +logLevel: "debug", +stepTimeout: 20000, +onStepTimeout: function(){ casper.die("Step timeout", 1); casper.exit() }, +pageSettings: { + loadImages: false, + loadPlugins: true, + userAgent: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.8 (KHTML, like Gecko) Chrome/17.0.940.0 Safari/535.8" +}, +viewportSize: { + width: 1280, + height: 1024 +} +}).start(); + +casper.options.onResourceRequested = function(C, requestData, request) { + utils.dump("reqData"); + utils.dump(requestData); // here + utils.dump("req"); + utils.dump(request); // here +}; +casper.options.onResourceReceived = function(C, response) { + utils.dump("response"); + utils.dump(response); +}; +// so there is 500 on that request for some reason do we have any idea what the request is? wbell we have request object, +// prints headers and info about it + +casper.thenOpen('https://www.facebook.com/?_rdr', function() { //just the facebook login page ok, so need to try add sleep, and then +//print content again, maybe it just need more time +}); +//no good it seems, right? well i think i had same thing, it was because of ssl and ceritifcates, let's try one thing one sec. +casper.waitForSelector("#email", function() { + this.fill('form#login_form', { + email: 'andrew.fenlon@tufts.edu', + pass: '$mnesi42' + }, true); +// casper.sendKeys('#email', 'andrew.fenlon@tufts.edu') +// casper.sendKeys('#pass', '$mnesi42') +// casper.click('#u_0_l') +// this.echo(this.getTitle()); +}); + +casper.waitForSelector("#pagelet_welcome_box", function() { + +}); +casper.thenOpen('https://www.facebook.com/photo.php?fbid=108354332830245', function(){ + casper.scrollTo(0,0); + casper.scrollToBottom(); + fs.write("tmp.html", this.getHTML(), 'w'); + this.waitForSelector('a.UFILikeLink', function(){ } ); + this.waitForSelector('#fbPhotoImage', function(){ + this.waitForSelector('div.like', function(){ +// this.waitForSelector('a.UFILikeLink', function(){ +//// casper.echo(this.getHTML()) //should I write it to a file? yeah +// casper.click('button.like_link', function(){ casper.echo("clicked") }); +// looks good, it sort of click on it, but not sure if js was triggered, or only <a href link yeah no js +// seems impossible? well we can inject js code inside page to click it from inside with jquery not sure if that will working +// we should try though. I'm going to get some sleep for now, can we continue this again sure. thanks a lot no problems +// this.waitForSelector('a.UFILikeLink', function(){ //so a.UFILikeLink is very important, but isn't loading +////for some reason...do you know what UFI stands for? nope and there's no way to figure out why it's not working..? +////well i thought that likes are inside iframes or somehting, aren't they? no they're links, and I can click them, but it won't do anything +//// weird right? looked good, ajax request after link click hmm let's look at that request? is it possible to? not really +//any way to check like was set? it wasn't +//I'm able to like from curl, but there's a missing parameter that I'm not seeing in the dom, that's why I was hoping we could +//look at the parameters of that ajax call well with https we can't capture traffic from outside, and phantomjs doesn't have tools +//to get requests i think, need to check there are couple of things they offer http://phantomjs.org/network-monitoring.html +//should we use this? +// casper.echo("hello"); +// }); +// }) + + }); + }); +}); +casper.run(); +// +// +// +// +// +// +// +//var casper = require('casper').create(); +//casper.start('https://www.facebook.com/', function() { +// this.echo(this.getTitle()); +// this.echo("hellooooooooo"); +//}); +//casper.then(function(){ +//// casper.sendKeys('#email', 'andrew.fenlon@tufts.edu') +//// casper.sendKeys('#pass', '$mnesi42') +//// casper.click('#u_0_l') +// this.echo(this.getTitle()); +//}); +////casper.thenEvaluate +////casper.thenOpen('http://phantomjs.org', function() { +//// this.echo(this.getTitle()); +////}); +// +//casper.run(); |
