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

186
Visualizações
Automating entry of data and clicking a button through Javascript

I’m trying to make a loop to fill a text box on a website with whatever I type then add 0-9 at the end and click submit to guess a keyword. I can see with console.log that the loop works. When the script is run without the button click part I can see it goes to ‘text9’ in the text box so that means this part is also running but when I add the button click part, the loop stops after ‘text0’, the page loads and shows ‘wrong attempt’. How do I keep the loop running after it stops after the first attempt? Sorry for a dumb question, I’ve just started learning.


var str = "text"
var num = -1;
for (var i = 0; i<10; i++) { 
    num++;
    hola= str + num;
    document.getElementsByName('textbox')[0].value= hola

    document.getElementsByClassName('button-done')[0].click()
}

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

0

If you're just getting started with JavaScript testing, I would look into a framework called Jest (Docs). It will get you started with testing programs like you're trying to do in your question!

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