selenium中啓動chrome瀏覽器時,chrome驅動chromedriver.exe沒有存放在chrome安裝目錄下

chrome瀏覽器驅動chromedriver.exe存放在D盤下,代碼如下:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

/*
 * chrome瀏覽器驅動存放在D盤下
 */

public class KeywordBrowserChromePath {
	public static void main(String[] args) {

		//chrome的驅動存存放在D盤下
		System.setProperty("webdriver.chrome.driver", "D:\\chromedriver\\chromedriver.exe");
		WebDriver driver = new ChromeDriver();
		driver.get("http://www.baidu.com");		
	}
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章