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");
}
}