I'm trying to automate a task through selenium that deletes a set of database tables.
The corresponding code is
WebElement element=null;
while((element = driver.findElement(By.name("db__button"))) != null){
driver.findElement(By.name("db__button")).click();
driver.findElement(By.name("ConfirmButton")).click();
}
However I'm getting the following error:-
org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"name","selector":"db_vaults__button"}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
This runs fine as long as there are tables in the database but when there are no tables left then the GUI doesn't show any list (rightly so) and db__button
is not present on the page and therefore By.name("db__button")
is failing.
I guess there is something missing in this code which is trying to delete some tables in a loop.
The suggested link in the stack trace doesn't has any information.
Any Ideas?
Thanks.