-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenUrlProgram.java
More file actions
57 lines (39 loc) · 1.38 KB
/
OpenUrlProgram.java
File metadata and controls
57 lines (39 loc) · 1.38 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
package selenium;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class OpenUrlProgram {
public static void main(String[] args) throws Exception {
// Setting the property of chrome browser and passing chromedriver path
System.setProperty("webdriver.chrome.driver","D:\\software\\chromedriver_win32 (2)\\chromedriver.exe");
// Launching chrome browser instance
WebDriver driver = new ChromeDriver();
//manage() method
driver.manage().window().maximize();
// Opening URL of application using get() method
driver.get("https://en-gb.facebook.com/");
Thread.sleep(3000);
driver.navigate().to("https://www.google.com/");
// Refresh the page
Thread.sleep(3000); driver.navigate().refresh();
// Navigate back
Thread.sleep(3000);
driver.navigate(). back();
// Navigate forward
Thread.sleep(3000); driver.navigate().forward();
// Navigate back
Thread.sleep(3000);
driver.navigate().back();
// Get Current URL
Thread.sleep(3000);
String url= driver.getCurrentUrl(); System.out.println(url);
// Get Title of the Web Page
System.out.println(driver.getTitle());
Thread.sleep(3000);
// Close the current browser instance
Thread.sleep(3000);
driver.close();
// Closing all browser instance
Thread.sleep(3000);
driver.quit();
}
}