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

99
Visualizações
Ways to improve speed of execution of a js bot running in browser console

I have a simple js bot that rapidly answers coding questions in a text area by filling in javascript code and clicking submit button, using a for loop for all solutions I stored in an object:

Here is part of the solutions object:

const solutions = {
  'square': 'return x*x',
  'getType': 'return typeof(x);',
....}

Here is the actual submission and/or for loop:

const get_submit_button = () => document.querySelector('.task-buttons > .col > .btn');
const solve = () => {
  const ace_editor = ace.edit(document.querySelector('.ace_editor'))
  const submission = ace_editor.getValue()
  for (const key in solutions) {
    if (submission.includes('box.' + key + ' ')) {
      ace_editor.insert(solutions[key])
      get_submit_button().click()
      setTimeout(() => {
        get_submit_button().click()
        setTimeout(() => {
          solve()
        }, 400)
      }, 900)
      return
    }
  }
};

solve()

The loop is supposed to answer about 30 questions under 180 seconds. I have tried to reduce time in the setTimeout() function but it usually results in slower execution due to the code (solution being copied) multiple times in the text area.

Is there any way to improve speed of execution or the problem is related to my network speed (2Mb/s)?

about 4 years ago · Juan Pablo Isaza
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