- Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathSample6Task.java
More file actions
Latest commit
54 lines (47 loc) · 1.73 KB
/
Copy pathSample6Task.java
File metadata and controls
54 lines (47 loc) · 1.73 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
packageselenium.sample;
importorg.junit.After;
importorg.junit.Before;
importorg.junit.Test;
importorg.openqa.selenium.By;
importorg.openqa.selenium.WebDriver;
importorg.openqa.selenium.chrome.ChromeDriver;
importjava.io.File;
publicclassSample6Task {
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.close();
}
@Test
publicvoidfindElementByXPath() throwsException {
// TODO:
// 2 ways to find text: "Heading 2 text":
// 1-2 ways to find text: "Test Text 1"
// 1-2 ways to find text: "Test Text 2"
// 1-2 ways to find text: "Test Text 3"
// 1-2 ways to find text: "Test Text 4"
// 1-2 ways to find text: "Test Text 5"
// 1-2 ways to find text: "This is also a button"
}
@Test
publicvoidfindElementByCssName() throwsException {
// TODO:
// 1-2 ways to find text: "Heading 2 text"
// 1-2 ways to find text: "Test Text 1"
// 1-2 ways to find text: "Test Text 2"
// 1-2 ways to find text: "Test Text 3"
// 1-2 ways to find text: "This is also a button"
}
}