diff --git a/dotnet/src/support/UI/PopupWindowFinder.cs b/dotnet/src/support/UI/PopupWindowFinder.cs index e7c65bb255e3c..4364a97ae7c23 100644 --- a/dotnet/src/support/UI/PopupWindowFinder.cs +++ b/dotnet/src/support/UI/PopupWindowFinder.cs @@ -130,7 +130,7 @@ public string Invoke(Action popupMethod) ReadOnlyCollection existingHandles = this.driver.WindowHandles; popupMethod(); - WebDriverWait wait = new WebDriverWait(SystemClock.Instance, this.driver, this.timeout, this.sleepInterval); + var wait = new WebDriverWait(this.driver, this.timeout, this.sleepInterval); string popupHandle = wait.Until(driver => { ReadOnlyCollection newHandles = driver.WindowHandles; diff --git a/dotnet/src/webdriver/Support/WebDriverWait.cs b/dotnet/src/webdriver/Support/WebDriverWait.cs index 60f02765bab57..cbfe5bf315ec5 100644 --- a/dotnet/src/webdriver/Support/WebDriverWait.cs +++ b/dotnet/src/webdriver/Support/WebDriverWait.cs @@ -58,5 +58,17 @@ public WebDriverWait(IClock clock, IWebDriver driver, TimeSpan timeout, TimeSpan this.IgnoreExceptionTypes(typeof(NotFoundException)); } + /// + /// Initializes a new instance of the class. + /// + /// The WebDriver instance used to wait. + /// The timeout value indicating how long to wait for the condition. + /// A value indicating how often to check for the condition to be true. + /// If is . + public WebDriverWait(IWebDriver driver, TimeSpan timeout, TimeSpan sleepInterval) + : this(SystemClock.Instance, driver, timeout, DefaultSleepTimeout) + { + } + private static TimeSpan DefaultSleepTimeout => TimeSpan.FromMilliseconds(500); }