Created
October 4, 2016 00:06
-
-
Save aschyiel/31a568a2ff4278351eead1254c0850a5 to your computer and use it in GitHub Desktop.
casperJS google login example
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
// Also see http://stackoverflow.com/questions/35822029/casperjs-google-login-not-working | |
const env = require('system').env; | |
const google_email = env.MY_GOOGLE_EMAIL; | |
const google_passwd = env.MY_GOOGLE_PASSWD; | |
var casper = require('casper').create(); | |
casper.start('https://accounts.google.com/ServiceLogin?hl=EN', function() { | |
casper.waitForSelector('form#gaia_loginform #Email', function() { | |
this.fill('form#gaia_loginform', { | |
'Email': google_email | |
}, false); | |
this.click('#next'); | |
casper.waitForSelector('form#gaia_loginform #Passwd', function() { | |
this.fill('form#gaia_loginform', { | |
'Passwd': google_passwd | |
}, false); | |
this.click('#signIn'); | |
}); | |
}); | |
}); | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment