Skip to content

Instantly share code, notes, and snippets.

@pawel-dubiel
Forked from ecin/phantomjs_facebook.js
Created September 4, 2013 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pawel-dubiel/6439836 to your computer and use it in GitHub Desktop.
Save pawel-dubiel/6439836 to your computer and use it in GitHub Desktop.
console.log("got here");
var page = require('webpage').create();
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.open("http://facebook.com", function(status) {
if ( status === "success" ) {
page.evaluate(function() {
document.querySelector("input[name='email']").value = "email";
document.querySelector("input[name='pass']").value = "pass";
document.querySelector("#login_form").submit();
console.log("Login submitted!");
});
window.setTimeout(function () {
page.render('colorwheel.png');
phantom.exit();
}, 5000);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment