FAQ
Hi Pragnya,

please use the below method to check the alert verification...if the alert
is present it ll return true else false

public boolean isAlertPresent() {

   boolean presentFlag = false;

   try {

    // Check the presence of alert
    Alert alert = driver.switchTo().alert();
    // Alert present; set the flag
    presentFlag = true;
    // if present consume the alert
    alert.accept();

   } catch (NoAlertPresentException ex) {
    // Alert not present
    ex.printStackTrace();
   }

   return presentFlag;

  }

please let me know if it does not work for you.

Thanks,

Sudhansu
Mindfiresolutions.com
On Tuesday, 1 March 2016 16:03:49 UTC+5:30, Pragnya Sahoo wrote:

I'm testing an webpage where the alert messages pops up randomly. And I
want to close those alert messages as they appear.

But don't know or can't able to think how to handle this situation through
selenium webdriver.

Please help me on this.

Thanks in Advance.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3f5ab816-bea1-4926-bb6c-b56b33e11130%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 5 | next ›
Discussion Overview
groupselenium-users @
categoriesselenium
postedMar 1, '16 at 10:33a
activeMar 2, '16 at 7:45a
posts5
users4
websiteseleniumhq.org

People

Translate

site design / logo © 2021 Grokbase