selenium2.0不通浏览器启动方式汇总
//打开默认路径的firefox
WebDriver diver = new FirefoxDriver();
//打开指定路径的firefox,方法1
System.setProperty("webdriver.firefox.bin",
"C:/Program Files/Mozilla Firefox/firefox.exe");
WebDriver driver = new FirefoxDriver();
//打开指定路径的firefox,方法2
File pathToFirefoxBinary = new File( "C:/Program Files/Mozilla Firefox/firefox.exe");
FirefoxBinary firefoxbin = new FirefoxBinary(pathToFirefoxBinary);
WebDriver driver1 = new FirefoxDriver(firefoxbin,null);
//打开ie
WebDriver ie_driver = new InternetExplorerDriver();
//打开chrome
下载chromedirver.exe 并解压放置到windows/system32目录下,
下载路径:http://chromedriver.storage.googleapis.com/index.html
System.setProperty("webdriver.chrome.bin","C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe");
WebDriver driver = new ChromeDriver();
//打开浏览器
driver.get("http://www.baidu.com");