public WebDriver Loopthisstuff (Webdriver driver, int X) {
additem.click();
WebElement answerX = driver.findElement(By.id("item_rowX_txt"));
answerX.sendKeys("ITEM NR X");
}
I am kinda new to coding,I am looking for a method to loop this piece NTIMES. The nature of the site is that every time you additem.click() it creates a new texfield with id "item_rowX_txt" with X increasing by one each time.
I also have to fill these fields with the SendKeys command. Any tips please? I have just started learning java and working with selenium. ( tried to make the code as little as I could). I did some googling about looping N times but I dont know how to implement it for a class, and how to use the same variable (X) at those places you see in the code.