title: Clarification of the cause of mixing Implicit and Explicit waits in Selenium doc
body: <p>I was reading the <a href="https://www.selenium.dev/documentation/en/webdriver/waits/#implicit-wait" rel="nofollow noreferrer">SeleniumHQ</a> documentation and came across the following statements.</p>
  
  <p><em>"WARNING: Do not mix implicit and explicit waits. Doing so can cause unpredictable wait times. For example setting an implicit wait of 10s and an explicit wait of 15 seconds, could cause a timeout to occur after 20 seconds."</em></p>
  
  <p>For some reason, I cannot get this to make sense. The total timeout 20s is the main confusion point for me. Can anyone explain if I am missing something?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p><em>My question is not about the implementation/consequences of mixing those waits. It's entirely about the statements and calculation of timeout on the doc.</em></p>
  
  <p><strong>2nd Edit</strong></p>
  
  <p>Looks like the doc is correct according to the tests below. <strong>I still need the explanation though</strong>.</p>
  
  <h1>Just Implicit wait</h1>
  
  <pre><code>using System;
  using System.Diagnostics;
  using NUnit.Framework;
  using OpenQA.Selenium;
  using OpenQA.Selenium.Chrome;
  
  namespace Test
  {
      [TestFixture]
      public class Test
      {
          private IWebDriver _webDriver;
  
          [Test]
          public void ExplicitVsImplicitWaitTest()
          {
              _webDriver = new ChromeDriver();
              _webDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
              _webDriver.Navigate().GoToUrl("https://www.google.com/");
              _webDriver.Manage().Window.Maximize();
  
              Stopwatch stopwatch = new Stopwatch();
              stopwatch.Start();
  
              try
              {
                  //new WebDriverWait(_webDriver, TimeSpan.FromSeconds(15)).Until(
                  //ExpectedConditions.ElementExists(By.CssSelector("Should Fail")));
                  _webDriver.FindElement(By.CssSelector("Should Fail"));
              }
              catch ( NoSuchElementException exception)
              //catch ( OpenQA.Selenium.WebDriverTimeoutException)
              {
                  stopwatch.Stop();
                  Console.WriteLine(stopwatch.Elapsed);
              }
  
              _webDriver.Quit();
  
          }
      }
  }
  </code></pre>
  
  <blockquote>
    <p>Time in second: 00:00:10.0167290</p>
  </blockquote>
  
  <h1>Just Explicit wait</h1>
  
  <pre><code>using System;
  using System.Diagnostics;
  using NUnit.Framework;
  using OpenQA.Selenium;
  using OpenQA.Selenium.Chrome;
  using OpenQA.Selenium.Support.UI;
  
  namespace Test
  {
      [TestFixture]
      public class Test
      {
          private IWebDriver _webDriver;
  
          [Test]
          public void ExplicitVsImplicitWaitTest()
          {
              _webDriver = new ChromeDriver();
              //_webDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
              _webDriver.Navigate().GoToUrl("https://www.google.com/");
              _webDriver.Manage().Window.Maximize();
  
              Stopwatch stopwatch = new Stopwatch();
              stopwatch.Start();
  
              try
              {
                  new WebDriverWait(_webDriver, TimeSpan.FromSeconds(15)).Until(
                  ExpectedConditions.ElementExists(By.CssSelector("Should Fail")));
                  _webDriver.FindElement(By.CssSelector("Should Fail"));
              }
              //catch ( NoSuchElementException exception)
              catch ( OpenQA.Selenium.WebDriverTimeoutException)
              {
                  stopwatch.Stop();
                  Console.WriteLine(stopwatch.Elapsed);
              }
  
              _webDriver.Quit();
  
          }
      }
  }
  </code></pre>
  
  <blockquote>
    <p>Time in second: 00:00:15.2463079</p>
  </blockquote>
  
  <h1>Mixed, Explicit and Implicit both</h1>
  
  <pre><code>using System;
  using System.Diagnostics;
  using NUnit.Framework;
  using OpenQA.Selenium;
  using OpenQA.Selenium.Chrome;
  using OpenQA.Selenium.Support.UI;
  
  namespace Test
  {
      [TestFixture]
      public class Test
      {
          private IWebDriver _webDriver;
  
          [Test]
          public void ExplicitVsImplicitWaitTest()
          {
              _webDriver = new ChromeDriver();
              _webDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
              _webDriver.Navigate().GoToUrl("https://www.google.com/");
              _webDriver.Manage().Window.Maximize();
  
              Stopwatch stopwatch = new Stopwatch();
              stopwatch.Start();
  
              try
              {
                  new WebDriverWait(_webDriver, TimeSpan.FromSeconds(15)).Until(
                  ExpectedConditions.ElementExists(By.CssSelector("Should Fail")));
                  _webDriver.FindElement(By.CssSelector("Should Fail"));
              }
              //catch ( NoSuchElementException exception)
              catch ( OpenQA.Selenium.WebDriverTimeoutException)
              {
                  stopwatch.Stop();
                  Console.WriteLine(stopwatch.Elapsed);
              }
  
              _webDriver.Quit();
  
          }
      }
  }
  </code></pre>
  
  <blockquote>
    <p>Time in second: 00:00:20.5771817</p>
  </blockquote>