title: ImplicitWait does not seem to work in Selenium Webdriver to wait for elements
body: <p>I am trying to automate the Internet Explorer in c# using selenium-webdriver to fill a formular on an external website.
  Sometimes the code throws randomly errors (Unable to find element with name == xxx), because it cannot find the searched elements. It's not happening every time and not necessarily in the same places.</p>
  
  <p>I've already tried setting an implicitWait with the following code which reduced the number of errors.</p>
  
  <pre><code>    driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
  </code></pre>
  
  <p>The external webpage changes the selection options (through reloading) from Dropdowns after selecting an option from another Dropdown.
  To additionally intercept these critical points, I wait 2 seconds before trying to find the Dropdown-options <code>ByName()</code>.</p>
  
  <pre><code>    System.Threading.Thread.Sleep(2000);
  </code></pre>
  
  <p>The webpage takes less than half a second to reload this Dropdowns, so that 2 seconds should be enough.</p>
  
  <p>Can you tell me what i'm doing wrong or why the webdriver seems to run so instably finding elements.
  I have also noticed that I am not allowed to do anything else on the computer as long as the program is running, otherwise the same error occurs more often.</p>
  
  <p>My driver-options for internet explorer 8</p>
  
  <pre><code>        var options = new InternetExplorerOptions()
          {
              InitialBrowserUrl = "ExternalPage",
              IntroduceInstabilityByIgnoringProtectedModeSettings = true,
              IgnoreZoomLevel = true,
              EnableNativeEvents = false,
              RequireWindowFocus = false                
          };
  
          IWebDriver driver = new InternetExplorerDriver(options);
          driver.Manage().Window.Maximize();
  </code></pre>
  
  <p><strong>My final solution working perfectly without a single error in more than 20 tests!</strong></p>
  
  <p>Added the following in the class </p>
  
  <pre><code>     enum type
       {
          Name,
          Id,
          XPath
       };
  </code></pre>
  
  <p>Added this behind my driver</p>
  
  <pre><code>    driver.Manage().Window.Maximize();
      wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
  </code></pre>
  
  <p>Methode to wait for an element</p>
  
  <pre><code>    private static void waitForElement(type typeVar, String name)
      {
              if( type.Id)wait.Until(ExpectedConditions.ElementToBeClickable(driver.FindElement(By.Id(name)))); 
              else if(type.Name)wait.Until(ExpectedConditions.ElementToBeClickable(driver.FindElement(By.Name(name))));
              else if(type.XPath)wait.Until(ExpectedConditions.ElementToBeClickable(driver.FindElement(By.XPath(name))));                   
      }
  </code></pre>
  
  <p>And call the methode before calling any event with the element</p>
  
  <pre><code>    waitForElement(type.Id, "ifOfElement");
  </code></pre>