forked from florentbr/SeleniumBasic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTS_Scraping.cs
More file actions
38 lines (31 loc) · 1.14 KB
/
TS_Scraping.cs
File metadata and controls
38 lines (31 loc) · 1.14 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
using Selenium.Tests.Internals;
using A = NUnit.Framework.Assert;
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_Scraping : BaseBrowsers {
public TS_Scraping(Browser browser)
: base(browser) { }
[TestCase]
public void ShouldScrapTextFromTable() {
driver.Get("/table.html");
var element = driver.FindElementByCss("#table table");
TableElement table = element.AsTable();
var data = table.Data();
A.AreEqual(data[1, 1], "Table Heading 1");
A.AreEqual(data[6, 5], "Table Footer 5");
}
[TestCase]
public void ShouldScrapTextFromElements() {
driver.Get("/table.html");
var elements = driver.FindElementsByCss("thead th");
var data = elements.Text();
A.AreEqual(data[0], "Table Heading 1");
}
}
}