0 votes
1 view
in Devops and Agile by (28.4k 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 (28.4k 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")));

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...