// Searching and deleting process
driver.findElement(By.cssSelector("input[type='search']")).sendKeys("Diversification Rule Template");
driver.findElement(By.className("delete-template")).click();
Alert alert = driver.switchTo.alert();
Thread.sLeep(200);
alert.accept();
String SuccessMessage = driver.findElement(By.className("toast")).getAttribute("class");
System.out.println("Toast Message: " n SuccessMessage);
Assert.assertEquals("toast toast-success", SuccessMessage);
// Repeat for Diversification Rule Template2
driver.findElement(By.cssSelector("input[type='search']")).clear();
Thread.sLeep(200);
driver.findElement(By.cssSelector("input(type='search']")).sendKeys("Diversification Rule Template2");
driver.findElement(By.className("delete-template")).click();
driver.switchTo().alert();
alert.accept();
String SuccessDeleteMessage = driver.findElement(By.className("toast")).getAttribute("class");
System.out.println("Toast Message: " SuccessDeleteMessage);
Assert.assertEquaLs("toast toast-success", SuccessDeleteMessage);
// Another search and delete process
driver.findElement(By.cssSelector("input[type='search']")).clear();
Thread.steep(200);
driver.findElement(By.cssSelector("input[type='search']")).sendKeys("New Diversification Rule");
driver.findElement(By.className("delete.template")).click();
driver.switchTo().alert();
alert.accept();
String SuccessDeleteMessage2 = driver.findElement(By.className("toast")).getAttribute("class");
System.out.println("Toast Message: SuccessDeleteMessage2);
I am facing an issue with elements not being attached to the page document while trying to implement loops for easier deletion of users from the system. Any assistance or guidance on overcoming this problem would be greatly appreciated.