title: Selenium C# Webdriver - IgnoreExceptionTypes does not work
body: <p>I'm trying to optimize selenium tests and wanted to control the poll interval better so I decided to use DefaultWait that allows access to defined the polling period. </p>
  
  <p>However, an unanticipated problem occurred - IgnoreExceptionTypes seems not to work or I'm doing something incorrectly. It fails immediately, not when the Timeout expires.</p>
  
  <p>I have tried:</p>
  
  <ul>
  <li><p><code>new WebDriverWait(driver, tss).Until(ExpectedConditions.TitleContains("Certificate Error"));</code> - worked well for me, but I want the poll to be smaller than 500ms, for precision;</p></li>
  <li><p>Providing different exception types;</p></li>
  <li><p>I have removed <code>new WebDriverWait</code> so that only <code>DefaultWait</code> would exist, apparently, since people had problems mixing up different wait objects, see here: <a href="https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/8062" rel="nofollow noreferrer">https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/8062</a></p></li>
  <li><p>If I add <code>Task.Delay(3000).Wait();</code> before the first wait.Until what throws the exception, then it does not throw it anymore (since the page is able to load and element is present), however subsequent waits fail in the same way.</p></li>
  </ul>
  
  <p>Let me know what might be the cause of this, am I missing something?</p>
  
  <p>Screenshot:
  <a href="https://i.stack.imgur.com/gFCpm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gFCpm.png" alt="enter image description here"></a></p>
  
  <p>My code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading;
  using System.Threading.Tasks;
  using System.Diagnostics;
  
  using OpenQA.Selenium;
  using OpenQA.Selenium.IE;
  using OpenQA.Selenium.Firefox;
  using OpenQA.Selenium.Support.UI;
  
  namespace TestProject1
  {
      class Program1
      {
          static void Main(string[] args)
          {
  
              // Initialize IWebDriver parameters
              var service = InternetExplorerDriverService.CreateDefaultService();
              service.LogFile = @"C:\Users\cbfdbfd\Desktop\IE.log";
              service.LoggingLevel = InternetExplorerDriverLogLevel.Debug;
  
              // Initialize the IWebDriver
              IWebDriver driver = new InternetExplorerDriver(service);
  
              // Initialize the DefaultWait&lt;&gt;
              DefaultWait&lt;IWebDriver&gt; wait = new DefaultWait&lt;IWebDriver&gt;(driver);
  
              wait.Timeout = TimeSpan.FromSeconds(50);
              wait.PollingInterval = TimeSpan.FromMilliseconds(50);
              wait.IgnoreExceptionTypes(typeof(NoSuchElementException));
  
              driver.Navigate().GoToUrl("https://dfbfd/login");
  
              wait.Until&lt;bool&gt;((d) =&gt; {
                  return d.Title.Contains("Certificate Error");
              });
  
              driver.Navigate()
                  .GoToUrl("javascript:document.getElementById('overridelink').click()");
  
              // handle login
              var username = driver.FindElement(By.Name("username"));
              var password = driver.FindElement(By.Name("password"));
  
              username.Clear(); username.SendKeys("fdbgfbf");
              password.Clear(); password.SendKeys("bgfbgfb");
  
              driver.FindElement(By.Id("login-btn")).Click();
  
              //Task.Delay(3000).Wait();
  
              // open supply chain profiles
              wait.Until&lt;IWebElement&gt;((d) =&gt; {
                  return d.FindElement(By.LinkText("fgbgfbgfbgf"));
              });
  
              driver.FindElement(By.LinkText("gfbgfbgf")).Click();
  
  
  
              // close driver
              Task.Delay(3000).Wait();
              driver.Close();
  
          }
      }
  }
  </code></pre>
  
  <p>Debug log:</p>
  
  <pre><code>D 2017-06-29 02:39:33:656 Browser.cpp(513) Not in navigating state
  D 2017-06-29 02:39:33:661 server.cc(355) Response: {"sessionId":"50577ecf-b46c-40a4-a2e0-ebb61a618d88","status":0,"value":null}
  
  D 2017-06-29 02:39:33:666 server.cc(281) Command: POST /session/50577ecf-b46c-40a4-a2e0-ebb61a618d88/element {"using":"link text","value":"Supply Chain"}
  D 2017-06-29 02:39:33:667 command.cc(36) Raw JSON command: { "name" : "findElement", "locator" : { "sessionid" : "50577ecf-b46c-40a4-a2e0-ebb61a618d88" }, "parameters" : {"using":"link text","value":"Supply Chain"} }
  D 2017-06-29 02:39:33:667 IECommandExecutor.cpp(544) No alert handle is found
  D 2017-06-29 02:39:33:667 ElementFinder.cpp(60) Using FindElement atom to locate element having linkText = Supply Chain
  I 2017-06-29 02:39:33:667 Browser.cpp(130) No child frame focus. Focus is on top-level frame
  D 2017-06-29 02:39:33:755 VariantUtilities.cpp(100) Result type is JScriptTypeInfo
  W 2017-06-29 02:39:34:014 response.cc(77) Error response has status code 7 and message 'Unable to find element with link text == Supply Chain' message
  D 2017-06-29 02:39:34:014 server.cc(355) Response: {"sessionId":"50577ecf-b46c-40a4-a2e0-ebb61a618d88","status":7,"value":{"message":"Unable to find element with link text == Supply Chain"}}
  
  D 2017-06-29 02:39:34:563 ElementRepository.cpp(113) Refreshing managed element cache. Found 0 to remove from cache.
  </code></pre>
  
  <p>Stack trace:</p>
  
  <pre><code>OpenQA.Selenium.NoSuchElementException occurred
    HResult=0x80131500
    Message=Unable to find element with link text == Supply Chain
    Source=WebDriver
    StackTrace:
     at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
     at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
     at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
     at OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByLinkText(String linkText)
     at OpenQA.Selenium.By.&lt;&gt;c__DisplayClass6.&lt;LinkText&gt;b__4(ISearchContext context)
     at OpenQA.Selenium.By.FindElement(ISearchContext context)
     at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)
     at TestProject1.Program.&lt;&gt;c.&lt;Main&gt;b__0_1(IWebDriver d) in C:\Users\bernam\Documents\Visual Studio 2017\Projects\ConsoleApp1\ConsoleApp1\Program.cs:line 90
     at OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition)
  </code></pre>