I have a for loop that constantly loops back a website to fill out and submit a search box with the next string from a list.
For example, if the list contains [abcd, efgh, ijkl....], the first loop would send abcd, the second loop would send efgh and etc.
Currently the loop sends the first string correctly, but on every loop afterwards, the string sent is added to the previous string. So instead of efgh on the second loop, it is abcdefgh.
How do I clear the keys so that I can just send the individual string? Here's what I have right now:
for(String value : List){
driver.get(Link);
Actions actions = new Actions(driver);
WebElement input_field = driver.findElement(By.id("txtBoxSearch"));
actions.moveToElement(input_field);
actions.click();
actions.sendKeys(value);
actions.build().perform();
WebElement submit_key = driver.findElement(By.xpath("//button[contains(@title, 'Search')]"));
actions.moveToElement(submit_key);
actions.click();
actions.build().perform();
}