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 8953521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:06:53+00:00 2026-06-15T14:06:53+00:00

We are working in legacy code and have a problem with flaky tests. I’d

  • 0

We are working in legacy code and have a problem with flaky tests.

I’d like to increase the default timeout, but the driver.findElement is used in a lot of places – overriding each call to use WebDriverWait would be a big task.

I found a recommendation to use implicit waits, which looked ideal as it only needed to be set once:

getDriver().manage().timeouts().implicitlyWait(5000, TimeUnit.MILLISECONDS);

I added this to the initialisation code block. Unfortunately, when I run one test case (50 tests) my performance bombs – increasing from ~30 seconds to 600 seconds.

I don’t understand why the performace has got so much worse – I thought it would only have taken the maximum time if the elements weren’t present (the tests passed). I thought this call would poll for the condition. But I also can’t see where to set the poll interval… It does mention in the documentation that it should be used judiciously, but this is completely unusable!

Are we on the right track with using implicitlyWait()? Is there another way to toughen up our tests?

UPDATE
On investigation, it appears that it is using implicitlyWait() and driver.getElements() that is slowing us down – if i nullify the implicitwait then reapply it straight after the call, then the tests run much faster. We use getElements ins over 400 places (!) – any recommendations on how to proceed?

  • 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-15T14:06:54+00:00Added an answer on June 15, 2026 at 2:06 pm

    We weren’t able to track down why this was happening with implicitlyWait. In the interests of making our build reliable, we wrote overrode getElement with our own polling mechanism, with a fairly low polling interval (100ms).

    This has improved the accuracy of our tests, without affecting the build duration.

    override def findElement(selector: By): WebElement = {
          val timeoutTime = System.currentTimeMillis() + timeout
          def helper(): WebElement = {
            try {
              super.findElement(selector)
            } catch {
              case exception: NoSuchElementException => {
                if (System.currentTimeMillis() >= timeoutTime) {
                  throw exception
                } else {
                  Thread.sleep(pollInterval)
                  helper()
                }
              }
            }
          }
          helper()
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When working with legacy code, and trying to create tests, I often break out
I'm working on getting some legacy code under unit tests and sometimes the only
I am working in a legacy code, and I am facing a strange problem.
I'm working on some legacy Django code. I have two nearly-identical views: @login_required def
I'm working with legacy code and have to require a .pl file that defines
I'm working on some legacy code. I have a user control with a VtChart
I'm working with some legacy code and have this existing interface: public interface IProcess
I'm working on a legacy PowerBuilder app, we have upgraded to PowerBuilder 12 but
I'm working with legacy Java code which returns java.lang.object. I'm passing it into a
I am working with some legacy code, and at some point there is a

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.