-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSample1Task.java
More file actions
28 lines (21 loc) · 841 Bytes
/
Sample1Task.java
File metadata and controls
28 lines (21 loc) · 841 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
package selenium.sample;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Sample1Task {
static String libWithDriversLocation = System.getProperty("user.dir") + "\\lib\\";
@Test
public void goToHomepage() throws Exception {
// define driver
System.setProperty("webdriver.chrome.driver", libWithDriversLocation + "chromedriver.exe");
WebDriver browser = new ChromeDriver();
// go to https://kristinek.github.io/site/index2.html
browser.get("https://kristinek.github.io/site/index2.html");
// get title of page
System.out.println(browser.getTitle());
// get URL of current page
System.out.println(browser.getCurrentUrl());
// close browser
browser.quit();
}
}