<commit_before>#!/usr/bin/env node
var debug = require('debug')('truskawka');
var config = require('./config');
var Horseman = require('node-horseman');
var horseman = new Horseman();

horseman.on('consoleMessage', function(msg){
  console.log(msg);
});

if(config.url !== undefined){
  var data = horseman
    .open(config.url)
    .manipulate(function(){
      $('#Login').contents().find('input[name=CC]').val(config.client);
      $('#Login').contents().find('input[name=UserID]').val(config.user);
      $('#Login').contents().find('input[name=UserPass]').val(config.password);
      $('#Login').contents().find('input[name=Login]').click();
    })
    .waitFor(function(){
      $('#WorkArea').contents().find('#HomePageTable').find('.seccion').find('h1').text() === "MIS DATOS PERSONALESMI GESTIÓN DEL TIEMPOMI COMPAÑÍA"
    }, true)
    .manipulate(function(){
      $('#WorkArea').contents().find('#HomePageTable').find('.seccion').find('li :nth-child(2)')[1].click();
    })
    .waitForNextPage()
    .manipulate(function(){
      $('#WorkArea').contents().find('#A3TblPayrollSheet_PBt').click();
    })
    .evaluate(function(){
      return $('#WorkArea').contents().find('#HomePageTable').find('.seccion').find('li :nth-child(2)').text();
    });

    /*
    Download pdf??
    https://github.com/johntitus/node-horseman/issues/3<commit_msg>Eliminada la necesidad de matar la primera ejecución con un ctrl+c<commit_after>#!/usr/bin/env node
var debug = require('debug')('truskawka');
var config = require('./config');
var Horseman = require('node-horseman');

if(config.url !== undefined){
  var horseman = new Horseman();

  horseman.on('consoleMessage', function(msg){
    console.log(msg);
  });
  var data = horseman
    .open(config.url)
    .manipulate(function(){
      $('#Login').contents().find('input[name=CC]').val(config.client);
      $('#Login').contents().find('input[name=UserID]').val(config.user);
      $('#Login').contents().find('input[name=UserPass]').val(config.password);
      $('#Login').contents().find('input[name=Login]').click();
    })
    .waitFor(function(){
      $('#WorkArea').contents().find('#HomePageTable').find('.seccion').find('h1').text() === "MIS DATOS PERSONALESMI GESTIÓN DEL TIEMPOMI COMPAÑÍA"
    }, true)
    .manipulate(function(){
      $('#WorkArea').contents().find('#HomePageTable').find('.seccion').find('li :nth-child(2)')[1].click();
    })
    .waitForNextPage()
    .manipulate(function(){
      $('#WorkArea').contents().find('#A3TblPayrollSheet_PBt').click();
    })
    .evaluate(function(){
      return $('#WorkArea').contents().find('#HomePageTable').find('.seccion').find('li :nth-child(2)').text();
    });

    /*
    Download pdf??
    https://github.com/johntitus/node-horseman/issues/3
{'fraction_non_alphanumeric': 0.23637675929267413, 'fraction_numerical': 0.004330566582461205, 'mean_word_length': 4.4674556213017755, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4064873', 'n_tokens_mistral': 923, 'n_tokens_neox': 920, 'n_words': 113}