Skip to content

Instantly share code, notes, and snippets.

@aschyiel
Created October 4, 2016 00:06
Show Gist options
  • Save aschyiel/31a568a2ff4278351eead1254c0850a5 to your computer and use it in GitHub Desktop.
Save aschyiel/31a568a2ff4278351eead1254c0850a5 to your computer and use it in GitHub Desktop.
casperJS google login example
// 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