ChromeDriver,IEDriver,Firefox配置

时间:2023-03-08 16:42:50

ChromeDriver:

下载ChromeDriver.exe,放入某个文件夹,如C:\Program Files (x86)\Google\Chrome\Application,把此路径加入path系统环境变量或者设置System.setProperty("webdriver.chrome.driver", "C:/Program Files (x86)/Google/Chrome/Application/chromedriver.exe"),即可WebDriver driver
= new ChromeDriver();

IEDriver:

下载IEDriverServer.exe,放入某个文件夹,如C:\Program Files (x86)\Google\Chrome\Application,把此路径加入path系统环境变量或者设置System.setProperty("webdriver.ie.driver", "C:/Program Files (x86)/Google/Chrome/Application/IEDriverServer.exe"),即可

WebDriver driver=new InternetExplorerDriver();

Firefox:

不需下载Driver,如果火狐安装不在默认路径,需加入path或者setProperty

System.setProperty("webdriver.firefox.bin", "D:/Program Files (x86)/Mozilla Firefox/firefox.exe");

        WebDriver driver = new FirefoxDriver();