-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestSample.java
More file actions
76 lines (42 loc) · 1.9 KB
/
Copy pathTestSample.java
File metadata and controls
76 lines (42 loc) · 1.9 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package main.webdriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
public class TestSample {
public static String browser = "ie";
public static WebDriver driver;
public static void main(String[] args) {
//ctrl + shift + O
/*
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true);
*/
if(browser.equals("firefox")){
driver = new FirefoxDriver();
}else if(browser.equals("chrome")){
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "\\GecoDriver\\geckodriver.exe");
driver = new ChromeDriver();
}else if(browser.equals("ie")){
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true);
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "\\GecoDriver\\geckodriver.exe");
driver = new InternetExplorerDriver(capabilities);
}
driver.get("http://google.com");
String actual_title = driver.getTitle();
System.out.println(actual_title);
String expected_title = "Google";
if(actual_title.equals(expected_title)){
System.out.println("Test case pass");
}else{
System.out.println("Test case fail");
}
driver.close(); // current browser
driver.quit(); //current browser + Entire session kill
}
}