Ignoring exceptions when using c# selenium webdriverWait wait.untill() function

WebDriverWait implements DefaultWait class that contains public void IgnoreExceptionTypes(params Type[] exceptionTypes) method.

You can use this method for defining all the exception types you want to ignore while waiting for element to get enabled before clicking.

For example :

WebDriverWait wdw = new WebDriverWait(driver, TimeSpan.FromSeconds(120));
wdw.IgnoreExceptionTypes(typeof(NoSuchElementException), typeof(ElementNotVisibleException));

In the preceding code wait will ignore NoSuchElementException and ElementNotVisibleException exceptions