Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (27.5k points)

When trying to explicitly wait for an element to become visible using ExpectedConditions, Visual Studio warns me that it is now obsolete and will be removed from Selenium soon.

What is the current/new method to achieve the same result?

var wait = new WebDriverWait(driver, new TimeSpan(0, 0, 30));

var element = wait.Until(ExpectedConditions.ElementIsVisible(By.Id("content-section")));

1 Answer

0 votes
by (27.5k points)

Step 1: Using nuget, search for DotNetSeleniumExtras.WaitHelpers, 

Step 2: Import that namespace into your class. 

Step 3: Then run the following code:

var wait = new WebDriverWait(driver, new TimeSpan(0, 0, 30));

var element = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Id("content-section")));

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s automation testing certification

Browse Categories

...