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

Eventlistener for an alert of a webpage

$
0
0

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?


Viewing all articles
Browse latest Browse all 98814

Trending Articles



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