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