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

  • SEARCH
  • Home
  • 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 6879965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:54:50+00:00 2026-05-27T04:54:50+00:00

I have a command webDriver.switchTo().alert(); which has a timeout and waits until it found

  • 0

I have a command webDriver.switchTo().alert(); which has a timeout and waits until it found an alert or the elapsed time is greater than the timeout value. I want to decrease the timeout for this particular command, but didn’t find a way. How can i do it?

If possible i’d like to set the timeout to zero, but then back to its default after the alert command.

Update

That’s the Selenium core functionality, and i use it as follows:

    try {
        // TODO PERFORMANCE PROBLEM BECAUSE OF TIMEOUT IF NO ALERT EXISTS
        Alert alert = webDriver.switchTo().alert();

        // check if alert exists
        if(alert != null) {
            String alertText = alert.getText();

            // TODO alert handling
            log.info("Alert detected: {}", alertText);
        }
    } catch (Exception e) {
        // timeout if alert does not exist
    }
  • 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-05-27T04:54:51+00:00Added an answer on May 27, 2026 at 4:54 am

    Without seeing the class that’s wrapping that method call, I’ll have to make a guess. My guess is that you have this wrapped in a wait for alert or some other function that’s blocking until the page is either done loading or until document.ready is complete. So whatever is blocking the script, which should be verifiable by running the application in debug and stepping through the methods. If you want to post some more code up then I might be able to help you better.

    ——– EDIT ———-

    The only way your going to be able to do that is to extend the Alert class in the Selenium namespace. overload it with an instant fail and I am guessing that it’s using some form of javascript to switch to the alert which you should be able to specify fail on the first try. I can’t give you any specific code because I can’t find the source for the Alert class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Command, which Check for CanExecute takes much of time. Now, I
I have a command line program, which outputs logging to the screen. I want
Let's assume that we have command X which can be executed in shell and
I have a command-line C program (DOS/Windows) which produces a hex dump of several
I have a command-line executable which I need to run from Java on Windows
For security reasons (I'm a developer) I do not have command line access to
I have a command line executable that alters some bits in a file that
I have a command line Ruby app I'm developing and I want to allow
I have a command that runs fine if I ssh to a machine and
I have a command-line process I would like to automate and capture in C#.

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.