Last active
July 19, 2017 05:52
-
-
Save dhilipsiva/7aba5905c963dd9c9da82fef17b101bc to your computer and use it in GitHub Desktop.
SumHR Login Click-In script. Using 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
// INSTRUCTIONS: | |
// 1. Update "USERNAME", "PASSWORD" and "COMPANY" | |
// 2. In terminal, run `pjantomjs clockin.js` | |
// 3. Have a coffee and start coding away :) | |
// You can also run this as a CRON script everyday! | |
var USERNAME="USERNAME", | |
PASSWORD="PASSWORD", | |
COMPANY="COMPANY", | |
sys = require("system"), | |
page = require("webpage").create(), | |
logResources = false, | |
postBody = "UserLogin[username]=" + USERNAME + "&UserLogin[password]=" + PASSWORD; | |
page.open("https://" + COMPANY + ".sumhr.com/user/login", 'POST', postBody, function(status){ | |
page.evaluate(function() { | |
var btn = document.getElementById("attendance-logger-widget"); | |
btn.click(); | |
}); | |
}); | |
setTimeout(function () {phantom.exit();}, 10000); // Wait for 10 secs because SumHR takes a long time to load :P |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment