forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestElementPresent.cs
39 lines (36 loc) · 1.21 KB
/
TestElementPresent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using System.Threading;
namespace Selenium.Tests
{
[TestFixture]
public class TestElementPresent : SeleniumTestCaseBase
{
[Test]
public void ShouldDetectElementPresent()
{
selenium.Open("../tests/html/test_element_present.html");
Assert.IsTrue(selenium.IsElementPresent("aLink"));
selenium.Click("removeLinkAfterAWhile");
for (int second = 0; ; second++)
{
if (second >= 60) Assert.Fail("timeout");
try { if (!selenium.IsElementPresent("aLink")) break; }
catch (Exception) { }
Thread.Sleep(1000);
}
Assert.IsFalse(selenium.IsElementPresent("aLink"));
selenium.Click("addLinkAfterAWhile");
for (int second = 0; ; second++)
{
if (second >= 60) Assert.Fail("timeout");
try { if (selenium.IsElementPresent("aLink")) break; }
catch (Exception) { }
Thread.Sleep(1000);
}
Assert.IsTrue(selenium.IsElementPresent("aLink"));
}
}
}