Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8700921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:16:49+00:00 2026-06-13T02:16:49+00:00

In selenium framework 2.25, I see that we have the UnexpectedAlertBehaviour enum type, but

  • 0

In selenium framework 2.25, I see that we have the UnexpectedAlertBehaviour enum type, but I don’t know how to use it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:16:51+00:00Added an answer on June 13, 2026 at 2:16 am

    I found this portion of documentation on your issue:
    This may be useful for other people as well:

    v2.25.0

    =======

    WebDriver:

    • Added API for dealing with BASIC and DIGEST authentication

      dialogs. Currently not implemented in any drivers.

    • Warn users that the IE driver will no longer use the DLL in the

      next release.

    • Deprecated browser specific WebElement subclasses.

    • Added support for “requiredCapabilities” to the remote webdrivers

      and implemented basic support for these in the firefox

      driver. Failure to fulfull a required capability will cause a

      SessionNotCreatedException to be thrown.

    • Added the ability to determine how unhandled alerts should be
      handled. This is handled by the “unexpectedAlertBehaviour”
      capability, which can be one of “accept”, “dismiss” or
      “ignore”. Java code should use the UnexpectedAlertBehaviour
      enum. This is only implemented in Firefox for now.

    • Allow native events to be configured in Firefox and

      (experimentally) in IE using the “nativeEvents” capability.

    • Updated supported versions of Firefox to 17.

    …..

    Whole list provided here

    An here is the source

    package org.openqa.selenium;
    
        public enum UnexpectedAlertBehaviour {
    
          ACCEPT ("accept"),
          DISMISS ("dismiss"),
          IGNORE ("ignore")
          ;
    
          private String text;
    
          private UnexpectedAlertBehaviour(String text) {
            this.text = text;
          }
    
          @Override
          public String toString() {
            return String.valueOf(text);
          }
    
          public static UnexpectedAlertBehaviour fromString(String text) {
            if (text != null) {
              for (UnexpectedAlertBehaviour b : UnexpectedAlertBehaviour.values()) {
                if (text.equalsIgnoreCase(b.text)) {
                  return b;
                }
              }
            }
            return null;
          }
        }
    

    As I see you use unexpectedAlertBehaviour to decide whether alert is unhandled and if it is so, you’ll decide how to handle it.

    I suppose it should be something like (my assumption):

    try{
    alert.accept();
    }
    
    catch(org.openqa.selenium.UnexpectedAlertBehaviour){
    ///...blablabla
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I see that Selenium 2 now supports WebDriverEventListener but the events don't really seem
I don’t have experience with BDD but after some research I see that it
When I use MSTest Framework, and copy the code that Selenium IDE generated for
We have an application where we use the Selenium test framework. The application runs
I have been using Selenium Library with Robot Framework for writing automated tests for
I need to verify using Selenium (or similar framework) that certain HTML content/items are
I have quite a fundamental problem that none of my selenium phpunit tests pass
I'll try to make a brief description of my Selenium framework so that I
I am using Selenium WebDriver with Java & TestNG framework. I want to use
I'm writing a selenium test using the Play! Framework and some tests have common

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.