Created
January 7, 2016 05:20
-
-
Save JacobHsu/d19a5dfd7a7c52ebfc61 to your computer and use it in GitHub Desktop.
Log into Facebook with phantomJS
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 page = require('webpage').create(); | |
var fillLoginInfo = function(){ | |
var frm = document.getElementById("login_form"); | |
frm.elements["email"].value = 'your fb email/username'; | |
frm.elements["pass"].value = 'password'; | |
frm.submit(); | |
} | |
page.onLoadFinished = function(){ | |
if(page.title == "歡迎來到 Facebook -登入、註冊或瞭解更多"){ | |
page.evaluate(fillLoginInfo); | |
page.render('./screens/login.png'); | |
return; | |
} | |
else | |
page.render('./screens/some.png'); | |
console.log("completed"); | |
phantom.exit(); | |
} | |
page.open('https://www.facebook.com/'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment