forked from janbodnar/Java-Advanced
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestTitle.java
More file actions
40 lines (29 loc) · 884 Bytes
/
TestTitle.java
File metadata and controls
40 lines (29 loc) · 884 Bytes
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
package com.zetcode.web;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
class TestTitle {
private static WebDriver driver;
@BeforeAll
static void setUp() {
var opt = new FirefoxOptions();
opt.setHeadless(true);
driver = new FirefoxDriver(opt);
}
@Test
public void testTitle() {
driver.get("http://webcode.me");
System.out.println("Page title is: " + driver.getTitle());
Assertions.assertEquals("My html page", driver.getTitle());
}
@AfterAll
static void tearDown() {
if (driver != null) {
driver.quit();
}
}
}