forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestFramesClick.cs
51 lines (50 loc) · 2.15 KB
/
TestFramesClick.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
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using System.Threading;
namespace Selenium.Tests
{
[TestFixture]
public class TestFramesClick : SeleniumTestCaseBase
{
[Test]
public void ShouldBeAbleToClickInFrames()
{
selenium.Open("../tests/html/Frames.html");
selenium.SelectFrame("mainFrame");
selenium.Open("../tests/html/test_click_page1.html");
// Click a regular link
Assert.AreEqual("Click here for next page", selenium.GetText("link"));
selenium.Click("link");
selenium.WaitForPageToLoad("30000");
Assert.AreEqual("Click Page Target", selenium.GetTitle());
selenium.Click("previousPage");
selenium.WaitForPageToLoad("30000");
Assert.AreEqual("Click Page 1", selenium.GetTitle());
// Click a link with an enclosed image
selenium.Click("linkWithEnclosedImage");
selenium.WaitForPageToLoad("30000");
Assert.AreEqual("Click Page Target", selenium.GetTitle());
selenium.Click("previousPage");
selenium.WaitForPageToLoad("30000");
// Click an image enclosed by a link
selenium.Click("enclosedImage");
selenium.WaitForPageToLoad("30000");
Assert.AreEqual("Click Page Target", selenium.GetTitle());
selenium.Click("previousPage");
selenium.WaitForPageToLoad("30000");
// Click a link with an href anchor target within this page
selenium.Click("linkToAnchorOnThisPage");
Assert.AreEqual("Click Page 1", selenium.GetTitle());
// Click a link where onclick returns false
selenium.Click("linkWithOnclickReturnsFalse");
// Need a pause to give the page a chance to reload (so this test can fail)
Thread.Sleep(300);
Assert.AreEqual("Click Page 1", selenium.GetTitle());
selenium.SetTimeout("5000");
selenium.Open("../tests/html/test_click_page1.html");
// TODO Click a link with a target attribute
}
}
}