@@ -240,8 +240,12 @@ el = WebDriverWait(driver).until(lambda d: return d.find_element_by_tag_name("p"
240
240
assert el.text == "Hello from JavaScript!"
241
241
{{< / code-panel >}}
242
242
{{< code-panel language="csharp" >}}
243
- // We don't have a C# code sample yet - Help us out and raise a PR
244
- {{< / code-panel >}}
243
+ using (var driver = new FirefoxDriver())
244
+ {
245
+ var foo = new WebDriverWait(driver, TimeSpan.FromSeconds(3))
246
+ .Until(drv => drv.FindElement(By.Name("q")));
247
+ Debug.Assert(foo.Text.Equals("Hello from JavaScript!"));
248
+ } {{< / code-panel >}}
245
249
{{< code-panel language="ruby" >}}
246
250
# We don't have a Ruby code sample yet - Help us out and raise a PR
247
251
{{< / code-panel >}}
@@ -293,8 +297,7 @@ new WebDriverWait(driver, 3).until(ExpectedConditions.elementToBeClickable(By.xp
293
297
WebDriverWait(driver, timeout=3).until(some_condition)
294
298
{{< / code-panel >}}
295
299
{{< code-panel language="csharp" >}}
296
- // We don't have a C# code sample yet - Help us out and raise a PR
297
- {{< / code-panel >}}
300
+ new WebDriverWait(driver, TimeSpan.FromSeconds(3)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("//a/h3"))); {{< / code-panel >}}
298
301
{{< code-panel language="ruby" >}}
299
302
# We don't have a Ruby code sample yet - Help us out and raise a PR
300
303
{{< / code-panel >}}
@@ -444,8 +447,16 @@ wait = WebDriverWait(driver, 10, poll_frequency=1, ignored_exceptions=[ElementNo
444
447
element = wait.until(EC.element_to_be_clickable((By.XPATH, "//div")))
445
448
{{< / code-panel >}}
446
449
{{< code-panel language="csharp" >}}
447
- // We don't have a C# code sample yet - Help us out and raise a PR
448
- {{< / code-panel >}}
450
+ using (var driver = new FirefoxDriver())
451
+ {
452
+ WebDriverWait wait = new WebDriverWait(driver, timeout: TimeSpan.FromSeconds(30))
453
+ {
454
+ PollingInterval = TimeSpan.FromSeconds(5),
455
+ };
456
+ wait.IgnoreExceptionTypes(typeof(NoSuchElementException));
457
+
458
+ var foo = wait.Until(drv => drv.FindElement(By.Id("foo")));
459
+ } {{< / code-panel >}}
449
460
{{< code-panel language="ruby" >}}
450
461
# We don't have a Ruby code sample yet - Help us out and raise a PR
451
462
{{< / code-panel >}}
0 commit comments