forked from florentbr/SeleniumBasic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTS_Select.cs
More file actions
55 lines (45 loc) · 1.63 KB
/
TS_Select.cs
File metadata and controls
55 lines (45 loc) · 1.63 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
using Selenium.Tests.Internals;
using A = NUnit.Framework.Assert;
using SetUp = NUnit.Framework.SetUpAttribute;
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_Select : BaseBrowsers {
public TS_Select(Browser browser)
: base(browser) { }
[SetUp]
public void SetUp() {
driver.Get("/select.html");
}
[TestCase]
public void ShouldListItems() {
var ele = driver.FindElementById("select").AsSelect();
List lst = ele.Options.Text();
A.AreEqual("Option One", lst.First());
A.AreEqual("Option Three", lst.Last());
}
[TestCase]
public void ShouldSelectByIndex() {
var ele = driver.FindElementById("select").AsSelect();
ele.SelectByIndex(1);
A.AreEqual("Option Two", ele.SelectedOption.Text());
}
[TestCase]
public void ShouldSelectByText() {
var ele = driver.FindElementById("select").AsSelect();
ele.SelectByText("Option Two");
A.AreEqual("Option Two", ele.SelectedOption.Text());
}
[TestCase]
public void ShouldSelectByValue() {
var ele = driver.FindElementById("select").AsSelect();
ele.SelectByValue("opt2");
A.AreEqual("opt2", ele.SelectedOption.Attribute("value"));
}
}
}