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()
}