RFE Petr
RFE Petr

Reputation: 694

Selenium - 'ITimeouts.ImplicitlyWait(TimeSpan)' is obsolete

I use the C # project settings implicity:

driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(20));

Everything worked. When I installed the new version of selenium-dotnet-3.1.0 my voice this error:

Warning CS0618 'ITimeouts.ImplicitlyWait(TimeSpan)' is obsolete: 'This method will be removed in a future version. Please set the ImplicitWait property instead.'

How to set the global ImplicitlyWait time?

Upvotes: 18

Views: 16102

Answers (3)

David Grandfield
David Grandfield

Reputation: 1

Could also use the add method and pass in the TimeSpan:

Driver.Manage().Timeouts().ImplicitWait.Add(TimeSpan.FromSeconds(20));

Upvotes: 0

Veniamin Lardo
Veniamin Lardo

Reputation: 29

I use Selenium.WebDriver v3.2.0 package (from NuGet), but I can't use ImplicitlyWait property:

RemoteDriver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), _capabilities);
driver = new EventFiringWebDriver(RemoteDriver);
driver.Manage().Timeouts().ImplicitlyWait = TimeSpan.FromSeconds(defaultTimeOut);

returns: Cannot assign to 'ImplicitlyWait' because it is a 'method group'

But driver.Manage().Timeouts().ImplicitlyWait(defaultTimeOut) works well although shows warning about new usage.

Upvotes: 1

Anton Angelov
Anton Angelov

Reputation: 1713

I had the same problem. You can use the following code:

driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);

Upvotes: 49

Related Questions