There is a page on which there are about 15 input fields, each is taken in the form tags.
I select all input fields in Selenium:
List<WebElement> formInput = driver.findElements(By.tagName("input"));
and ask them the value:
int i = 0; for(WebElement element: formInput){ ((JavascriptExecutor)driver) .executeScript("document.getElementsByTagName('input')["+i+"].value='TEST'", element); i++; }
Now I need to submit each form, but the problem is that when the form is submitted, it redirects to the page as: site.com/SaveResultId=xxx
And Selenium can no longer work with the following input, because it throws out Exception (which is logical since there are no input on the result page)
Is there any solution to add all fields one by one?
ideally add element.submit();
to the loop element.submit();