I need to know if a specific alert comes up on a webpage. I use an infinite loop inside a swingworker, something like this:
try{
WebElement container = driver.findElement(By.cssSelector("#alert > a"));
String gifAlert = container.getCssValue("background-image");
if(gifAlert.equals(alert){
//Do something
}
}catch(//Stuff){
//Stuff
}
is it possible to use an eventlistener that get continously the WebElement container and check continously if it matches alert instead of using a swingworker and that code inside an infinite loop?