forked from JeeKayPee/CSE-Code-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfiguration.java
More file actions
52 lines (41 loc) · 1.52 KB
/
Copy pathConfiguration.java
File metadata and controls
52 lines (41 loc) · 1.52 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
package common;
import java.io.File;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Configuration {
public static String DRIVER_DIR = System.getProperty("user.dir")
+ File.separator
+ "drivers"
+ File.separator;
public static String CHROME_DRIVER_PATH = DRIVER_DIR + "chromedriver";
public static String GECKO_DRIVER_PATH = DRIVER_DIR + "geckodriver";
private static String IP = "http://192.168.56.103";
public static String BLOG_URL = IP + "/";
public static String ADMIN_URL = IP + "/wp-admin";
public static String USER_NAME = "user";
public static String PASSWORD = "bitnami";
public static String SCREENSHOTS_DIR = System.getProperty("user.dir")
+ File.separator
+ "screenshots"
+ File.separator;
private static String modifyIfWindows(String inPath) {
if (System.getProperty("os.name").toLowerCase().contains("windows")){
return inPath + ".exe";
} else {
return inPath;
}
}
public static WebDriver createChromeDriver(ChromeOptions options) {
System.setProperty("webdriver.chrome.driver", modifyIfWindows(CHROME_DRIVER_PATH));
return new ChromeDriver(options);
}
public static WebDriver createChromeDriver() {
return createChromeDriver(new ChromeOptions());
}
public static WebDriver createFireFoxDriver() {
System.setProperty("webdriver.gecko.driver", modifyIfWindows(GECKO_DRIVER_PATH));
return new FirefoxDriver();
}
}