Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97799

How to implement Java loop using selenium

$
0
0
// to search and delete
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("Message of Toast Message is: " n SuccessMessage);
Assert.assertEquals("toast toast-success", SuccessMessage);

// to search and delete
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("Message of Toast Message is: " SuccessDeleteMessage);
Assert.assertEquaLs("toast toast-success", SuccessDeleteMessage); 

// to search and delete
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("Message of Toast Message is: SuccessDeleteMessage2); 

I need to delete few users from the system and I don't want to repeat the process over again and again. So I want to implement loops that I can do it easily and having such a problem "element is not attached to the page document". Any help would be great.


Viewing all articles
Browse latest Browse all 97799

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>