1

Possible Duplicate:
Selenium 2 Alert handling with Java

If I use driver.switchTo.alert(); for checking whether the alert is present or not it, it takes more than 2 seconds.

But, if I use below logic for checking, it takes less than 1 second.

Selenium sel=new WebDriverBackedSelenium(driver, "");
b = sel.isAlertPresent();

But the problem is that if an alert is not present, it is returning false, and if the alert is present instead it throws an UnhandledAlertException instead of just returning true.

Why is it throwing this exception instead of returning true?

Community
  • 1
  • 1
Santoshsarma
  • 5,627
  • 1
  • 24
  • 39
  • this topic has been already discussed here: http://stackoverflow.com/questions/8244723/selenium-2-alert-handling-with-java Hope this helps you) – eugene.polschikov Sep 11 '12 at 17:05
  • thank you polschikov. But, here my doubt is Why WebDriverBackedSelenium throwing exception if alert present? instead of throwing true. Is that issue with WebDriverBackedSelenium? – Santoshsarma Sep 12 '12 at 05:15

0 Answers0