标签:开发 常用类 定制 应用 根目录 auto drive ebe 浏览器
(1)什么是框架?
(2)为什么要写框架?
(3)框架的几个要素?
package com.lixx.drivers; 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; public class SeleniumDriver1 { public static WebDriver driver; public static WebDriver initialDriver(String browser){ //获取当前工程根目录 String path = System.getProperty("user.dir"); if (browser.equals("chrome")){ System.setProperty("webdriver.chrome.driver", path + "/driver/chromedriver.exe"); driver = new ChromeDriver(); }else if (browser.equals("ie")){ System.setProperty("webdriver.ie.driver", path + "/driver/IEDriverServer.exe"); driver = new InternetExplorerDriver(); }else if (browser.equals("firefox")){ driver = new FirefoxDriver(); }else if (browser.equals("edge")){ System.setProperty("webdriver.edge.driver", path + "/driver/MicrosoftWebDriver.exe"); driver = new EdgeDriver(); }else { System.out.println("您输入的浏览器名称有误,请确认!"); } return driver; } }
标签:开发 常用类 定制 应用 根目录 auto drive ebe 浏览器
原文地址:https://www.cnblogs.com/xinxin1994/p/11332539.html