Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

257
Visualizações
How can I run javascript like a batch file?

How can I run javascript like a batch file?

I want to run the script below at midnight every day.

However, if you do a command in window.location.href, all subsequent JavaScript commands are ignored.

I want to register and run the task scheduler in Windows environment, but is there any possible way?

async function init() {
   window.location.href = 'url where I want to go';
     await timer(3000);
}

init().then(e => {

window.alert = function() {};

const lists = document.querySelectorAll('.List > div.board-list > div.list > table > tbody > tr');


const timer = ms => new Promise(res => setTimeout(res, ms))

async function load() {
for (let list of lists) {
     console.log(list);
    list.querySelector('td.list-btn > a.btn.btn-primary').click();
     await timer(3000);
   }
}
});

Best Regards!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

To control a website, it needs to be loaded by a webbrowser. (for example Puppeteer, like Diego pointed out) You can find examples here. To execute the code once a day you can either use cron to call your file or use a package like Node schedule. With the secound solution the file needs to run already

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda