Skip to content

Commit 56c0618

Browse files
committed
[dotnet] Add WebDriverWait constructor for specifying a sleep interval without a clock
1 parent f52bb20 commit 56c0618

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

dotnet/src/support/UI/PopupWindowFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public string Invoke(Action popupMethod)
130130

131131
ReadOnlyCollection<string> existingHandles = this.driver.WindowHandles;
132132
popupMethod();
133-
WebDriverWait wait = new WebDriverWait(SystemClock.Instance, this.driver, this.timeout, this.sleepInterval);
133+
var wait = new WebDriverWait(this.driver, this.timeout, this.sleepInterval);
134134
string popupHandle = wait.Until(driver =>
135135
{
136136
ReadOnlyCollection<string> newHandles = driver.WindowHandles;

dotnet/src/webdriver/Support/WebDriverWait.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,17 @@ public WebDriverWait(IClock clock, IWebDriver driver, TimeSpan timeout, TimeSpan
5858
this.IgnoreExceptionTypes(typeof(NotFoundException));
5959
}
6060

61+
/// <summary>
62+
/// Initializes a new instance of the <see cref="WebDriverWait"/> class.
63+
/// </summary>
64+
/// <param name="driver">The WebDriver instance used to wait.</param>
65+
/// <param name="timeout">The timeout value indicating how long to wait for the condition.</param>
66+
/// <param name="sleepInterval">A <see cref="TimeSpan"/> value indicating how often to check for the condition to be true.</param>
67+
/// <exception cref="ArgumentNullException">If <paramref name="driver"/> is <see langword="null"/>.</exception>
68+
public WebDriverWait(IWebDriver driver, TimeSpan timeout, TimeSpan sleepInterval)
69+
: this(SystemClock.Instance, driver, timeout, DefaultSleepTimeout)
70+
{
71+
}
72+
6173
private static TimeSpan DefaultSleepTimeout => TimeSpan.FromMilliseconds(500);
6274
}

0 commit comments

Comments
 (0)