I am trying implicit wait in my code that is not applied for each and every element. I want to want 3 sec for selecting each and every element in my scripts.

  • You can use the the below code thread.sleep(3000) – chaitra teppad Mar 29 '19 at 11:58
  • Why? That will slow down the script with 3 seconds per element used. – Niels van Reijmersdal Apr 3 '19 at 10:14
  • If a question attracts 5 answers, I don’t get why there isn’t a single upvote… – beatngu13 Apr 3 '19 at 11:09

You can use the following code wherever you feel to add wait.

Thread.sleep(1000); //Enter your desired wait interval in milliseconds
| improve this answer | |

It depends on what you are trying to do.


Will stop your tests from failing if elements don't immediately appear on the page, with it waiting up to 10 seconds to find them. However click events will fire off immediately upon the element being found, not necessary when they are actually clickable.

e.g. If you click something and an overlay appears, then the next click event may still be actioned because the element exists in the DOM at that point, but the test will fail as the click would be applied against the overlay.

As others have suggested you can use Thread.sleep(x); to force the test to wait x amount of time, however this then slows down the test as even if it could continue it will wait x.


The better option is to work out what is causing the issue and wait for it to not be visible, or wait for the click element to be clickable:

wait = new WebDriverWait(driver, 10);

This then means it will wait 10 seconds for the element to report it is clickable, then click on it as soon as it does. Rather than as normal clicking the element as soon as it is located on the page.

| improve this answer | |

Per the docs


Session Implicit Wait Timeout
A session has an associated session implicit wait timeout that specifies a time to wait for the implicit element location strategy when locating elements using the findElement or findElements commands (respectively $ or $$ when running WebdriverIO with or without wdio testrunner). Unless stated otherwise it is zero milliseconds. You can set this timeout via:

browser.setTimeout({ 'implicit': 5000 });

In your case

browser.setTimeout({ 'implicit': 3000 });

As others note this global approach can significantly slow down tests. However if you have a lot of javascript and a lot of flaky tests and reliability is more important than run time then it may be a strategy that helps. Many folks find that despite the slowdown, being able to rely on passing tests, especially in a devops environment can be vital.

| improve this answer | |
  • 1
    This is how I would do it. Warning, it makes every call slower. Generally you'd prefer to use webdriver waits so you can adjust the amount of time waiting based on the part of the system under test. It's rarely a good practice to set the implicit timeout too high. – Veretax Apr 2 '19 at 20:36

Just add this line after driver instance:-

| improve this answer | |
  • System.setProperty("webdriver.chrome.driver", "C:\\Users\\Dell\\eclipse-workspace\\driver\\chromedriver.exe"); driver = new ChromeDriver(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); – anjith neerukonda Mar 29 '19 at 6:36
  • That is my code i am applying 10 but it will not wait 10 seconds by clickin elements @UpkarSingh – anjith neerukonda Mar 29 '19 at 6:37
  • It is defined only once and it will remain same throughout the driver object instance, may be in your code you have changed the driver instance. Can u please share your console, it will telling you the wait time that how much driver has wait for that element. – Upkar Singh Mar 29 '19 at 7:01
  • @anjithneerukonda for your better script try to use explicit wait or fluent wait, because these wait work on expected conditions. – Upkar Singh Mar 29 '19 at 7:05

It is a very bad practice to use Thread.Sleep for elements wait.

You can use Implicit or Explicit Wait provided by Selenium as per your use case.

You can refer below urls for more details:



And never mix use of Implicit and Explicit Wait as the Wait would not behave as expected.

Check below url for more details on that:


| improve this answer | |

Your Answer

