The selenium web driver seems to be indicating that OpenQA.Selenium.Support.UI.ExpectedConditions method is now deprecated, I would humbly ask for some assistance in rewriting the below statement, achieving the same outcome.

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(3));  

2 Answers 2


I recently replaced all our Wait.Until(ExpectedConditions.ElementToBeVisible(By.IDK(element)) to

Wait.Until(driver => driver.FindElement(By.IDK(element)).IsVisible());

  • Thanks Doug, I will check whether the InvisibilityOfElementLocated method is available using your suggestion.
    – BernardV
    Commented Jan 10, 2019 at 18:58
  • You wont be able to use "InvisibilityOfElementLocated" as it is a method within ExpectedConditions, instead use selenium IWebElement.isVisible() and negate it. !IWebElement.isVisible()
    – Doug Clark
    Commented Jan 10, 2019 at 20:27

They have moved the ExpectedConditions to another package that won't be maintained (unless someone steps forward).

The easiest (and cleanest) solution is to simply create a class in your framework where you can copy any ExpectedConditions you want to use. Even better, you can add your own as well.

So start from the actual class code (https://github.com/SeleniumHQ/selenium/blob/master/dotnet/src/support/UI/ExpectedConditions.cs) and rename the class to MyConditions, for example.

Usage would be:

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(3));  
  • Thanks for your feedback @FDM, this does make sense, I just wonder did the Selenium team not create something better / a new method that supersedes ExpectedConditions class?
    – BernardV
    Commented Jan 11, 2019 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.