- Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathSample2Task.java
More file actions
Latest commit
61 lines (51 loc) · 1.74 KB
/
Copy pathSample2Task.java
File metadata and controls
61 lines (51 loc) · 1.74 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
packageselenium.sample;
importorg.junit.After;
importorg.junit.Before;
importorg.junit.Test;
importorg.openqa.selenium.By;
importorg.openqa.selenium.WebDriver;
importorg.openqa.selenium.WebElement;
importorg.openqa.selenium.chrome.ChromeDriver;
importjava.io.File;
importjava.util.List;
publicclassSample2Task {
WebDriverdriver;
// method which is being run before each test
@Before
publicvoidstartingTests() throwsException {
// from Sample 1:
StringlibWithDriversLocation = System.getProperty("user.dir") + File.separator + "lib" + File.separator;
System.setProperty("webdriver.chrome.driver", libWithDriversLocation + "chromedriver" + newselenium.ChangeToFileExtension().extension());
// declaration above:
driver = newChromeDriver();
//open page:
driver.get("https://kristinek.github.io/site/examples/locators");
}
// method which is being run after each test
@After
publicvoidendingTests() throwsException {
driver.quit();
}
@Test
publicvoidfindElementByID() throwsException {
// TODO:
// get text "Heading 2 text" using id
}
@Test
publicvoidfindElementByName() throwsException {
// TODO:
// get attribute "id" and "value" of button "This is also a button" using name
}
@Test
publicvoidfindElementByClassFirst() throwsException {
// TODO:
// get first text of class "test" (should be "Test Text 1")
}
@Test
publicvoidfindElementByClassAll() throwsException {
// TODO:
// get size text of class "test" (should be 5)
// get text of class "test"
// get third text of class "test" (should be "Test Text 4")
}
}