Skip to content

Instantly share code, notes, and snippets.

View widyou's full-sized avatar

Widyou widyou

View GitHub Profile
@widyou
widyou / invenAttendance_v2.js
Created July 8, 2016 09:16
attendance to inven community with casperjs
var casper = require('casper').create({
pageSettings: {
userAgent: 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0'
}
});
casper.start('http://imart.inven.co.kr/attendance/').then(function() {
var checkText = this.evaluate(function() {
if ($('#comLeftOutloginV2').find('fieldset').length === 1)
return $('#comLeftOutloginV2').find('fieldset').text().replace(/\s+/g, ' ');
@widyou
widyou / invenAttendance.js
Last active July 7, 2016 09:05
attendance to inven community with phantomjs
"use strict";
var page = require('webpage').create();
function waitFor(testFx, onReady, onFail, timeOutMillis) {
var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 3000, // Default Max Timout is 3s
start = new Date().getTime(),
condition = false,
interval = setInterval(function() {
if ( (new Date().getTime() - start < maxtimeOutMillis) && !condition ) {
condition = testFx();