Created
September 4, 2020 14:45
-
-
Save marcusvx/45bc54a6d62e4418a19fb69833b9fb5b to your computer and use it in GitHub Desktop.
Automatização do preenchimento de horas
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
(async function automatizarChatice() { | |
const horarios = [ | |
'', '', | |
'', '', | |
'09:30', '19:00', | |
'09:30', '19:30', | |
]; | |
const caixinhasTexto = document.querySelectorAll(".txt40"); | |
const eventoKeyUp = new KeyboardEvent("keyup", { | |
bubbles: true, cancelable: true, keyCode: 13 | |
}); | |
for (var i = 0; i < horarios.length; i++) { | |
var h = horarios[i].trim(); | |
if (h == '') { | |
continue; | |
} | |
caixinhasTexto[i].dispatchEvent(eventoKeyUp); | |
/* espera a janela modal aparecer (ou ser criada pela primeira vez) */ | |
while (!document.getElementById('overlay') || !document.getElementById('overlay').style || !document.getElementById('overlay').style.display || document.getElementById('overlay').style.display == 'none') { | |
await new Promise(r => setTimeout(r, 300)); | |
} | |
/* seleciona radiobutton de home office */ | |
document.querySelectorAll('input[name=gpJustificativas]').forEach( | |
r => { | |
if (r.value == 4) { | |
r.click(); | |
} | |
} | |
); | |
document.getElementById('phTxtHora').value = horarios[i]; | |
document.getElementById('btnConfirmarMarcacao').click(); | |
/* espera a janela modal fechar */ | |
while (document.getElementById('overlay').style.display != 'none') { | |
await new Promise(r => setTimeout(r, 300)); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment