forked from florentbr/SeleniumBasic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTS_Windows.cs
More file actions
78 lines (62 loc) · 2.44 KB
/
TS_Windows.cs
File metadata and controls
78 lines (62 loc) · 2.44 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using Selenium.Tests.Internals;
using A = NUnit.Framework.Assert;
using SetUp = NUnit.Framework.SetUpAttribute;
using TearDown = NUnit.Framework.TearDownAttribute;
using TestCase = NUnit.Framework.TestCaseAttribute;
using TestFixture = NUnit.Framework.TestFixtureAttribute;
namespace Selenium.Tests {
[TestFixture(Browser.Firefox)]
[TestFixture(Browser.Opera)]
[TestFixture(Browser.Chrome)]
[TestFixture(Browser.IE)]
//[TestFixture(Browser.PhantomJS)]
class TS_Windows : BaseBrowsers {
public TS_Windows(Browser browser)
: base(browser) { }
[TearDown]
public void TearDown() {
driver.Quit();
}
[TestCase]
[IgnoreFixture(Browser.Opera, "Issue #14")]
public void ShouldSwitchToNextWindows() {
driver.Get("/win1.html");
driver.Wait(100);
A.AreEqual("Window1", driver.Title);
driver.FindElementByLinkText("Window2").Click();
driver.SwitchToNextWindow();
A.AreEqual("Window2", driver.Title);
driver.FindElementByLinkText("Window3").Click();
driver.SwitchToNextWindow();
A.AreEqual("Window3", driver.Title);
driver.SwitchToPreviousWindow();
A.AreEqual("Window2", driver.Title);
}
[TestCase]
[IgnoreFixture(Browser.Opera, "Issue #14")]
public void ShouldSwitchToWindows() {
driver.Get("/win1.html");
A.AreEqual("Window1", driver.Title);
driver.FindElementByLinkText("Window2").Click();
driver.SwitchToWindowByTitle("Window2");
A.AreEqual("Window2", driver.Title);
driver.FindElementByLinkText("Window3").Click();
driver.SwitchToWindowByTitle("Window3");
A.AreEqual("Window3", driver.Title);
driver.SwitchToWindowByName("win2");
A.AreEqual("Window2", driver.Title);
driver.SwitchToWindowByName("win3");
A.AreEqual("Window3", driver.Title);
}
[TestCase]
[IgnoreFixture(Browser.IE, "Not supported")]
[IgnoreFixture(Browser.Opera, "Issue #14")]
public void ShouldOpenLinkInNewWindow() {
driver.Get("/links.html");
driver.FindElementByLinkText("Win1", 5000).Click(Keys.Shift);
driver.SwitchToNextWindow();
driver.Wait(5000);
A.AreEqual("Window1", driver.Title);
}
}
}