Created
November 6, 2014 22:11
-
-
Save adnasa/a97ed2376c11cb1a51c0 to your computer and use it in GitHub Desktop.
Login into a system
This file contains hidden or 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(); | |
var utils = require('utils'); | |
var URL_LOGIN = ""; | |
var URL_AUTH = ""; | |
var AUTH_TOKEN = null; | |
var AUTH_EMAIL = null; | |
var AUTH_PASS = null; | |
casper.start(URL_LOGIN, function() { | |
AUTH_TOKEN = this.getElementInfo('input[name="token"]').attributes.value; | |
this.thenOpen(URL_AUTH, { | |
method: 'post', | |
data: { | |
token: AUTH_TOKEN, | |
email: AUTH_EMAIL, | |
password: AUTH_PASS | |
}, | |
headers: { | |
'Accept': 'application/json' | |
} | |
}, function(response) { | |
utils.dump(response); | |
}); | |
}); | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment