static WebDriver driver;
// 打开浏览器
static void openBrowser(String browserName) {
try {
switch (browserName) {
case "chrome":
System.setProperty("webdriver.chrome.driver", Constants.Path_chrome);
driver = new ChromeDriver();
// driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); //隐式等待
System.out.println("打开谷歌浏览器");
break;
case "firefox":
if (FileTools.getPropertyOsName().contains("Mac")) {
System.setProperty("webdriver.firefox.bin", Constants.Path_firefox);
} else if (FileTools.getPropertyOsName().contains("Windows")) {
System.setProperty("webdriver.gecko.driver", Constants.Path_firefox);
}
driver = new Fi
static WebDriver driver;
// 打开浏览器
static void openBrowser(String browserName) {
try {
switch (browserName) {
case "chrome":
System.setProperty("webdriver.chrome.driver", Constants.Path_chrome);
driver = new ChromeDriver();
// driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); //隐式等待
System.out.println("打开谷歌浏览器");
break;
case "firefox":
if (FileTools.getPropertyOsName().contains("Mac")) {
System.setProperty("webdriver.firefox.bin", Constants.Path_firefox);
} else if (FileTools.getPropertyOsName().contains("Windows")) {
System.setProperty("webdriver.gecko.driver", Constants.Path_firefox);
}
driver = new Fi