火狐: System.setProperty("webdriver.firefox.bin","D:\\Program Files\\Mozilla Firefox\\firefox.exe");
driver = new FirefoxDriver();
谷歌: System.setProperty("webdriver.chrome.driver","C:\\Program Files\\Google\\Chrome\\Application\\chromedriver.exe");
driver = new ChromeDriver();
IE: System.setProperty("webdriver.ie.driver","C:\\Program Files\\Internet Explorer\\IEDriverServer.exe");
driver = new FirefoxDriver();
以上 IEDriverServer.exe 和chromedriver.exe是你需要从selenium官网中下载下来,安装在哪里,路径就写哪里即可;
driver = new FirefoxDriver();
谷歌: System.setProperty("webdriver.chrome.driver","C:\\Program Files\\Google\\Chrome\\Application\\chromedriver.exe");
driver = new ChromeDriver();
IE: System.setProperty("webdriver.ie.driver","C:\\Program Files\\Internet Explorer\\IEDriverServer.exe");
driver = new FirefoxDriver();
以上 IEDriverServer.exe 和chromedriver.exe是你需要从selenium官网中下载下来,安装在哪里,路径就写哪里即可;