这是我的代码,要求在相同的本地chrome路径中打开URL。有可能吗??
public class Test{
public static void main(String args[]){
System.setProperty("webdriver.chrome.driver","C://Program Files (x86)//Google//Chrome//Application//chrome.exe");
WebDriver d= new ChromeDriver(); ;
String baseurl = "http://www.facebook.com/";
d.get(baseurl);
}
}
System.setProperty("webdriver.chrome.driver", "C:\Users\User\Downloads\chromedriver83\chromedriver.exe");
WebDriver driver = new ChromeDriver();
String baseurl = "http://www.facebook.com/";
driver.get(baseurl);
仔细检查计算机上chromedriver.exe的路径。
对于Windows用户:System.setProperty("webdriver.chrome.driver","C:\\Users\\user\\下载\\chromedriver.exe"(
WebDriver driver = new ChromeDriver();
driver.get("http://www.facebook.com");
对于MAC用户:
System.setProperty("webdriver.chrome.driver","//用户//苹果//下载//chromedriver"(
WebDriver driver = new ChromeDriver();
driver.get("http://www.facebook.com");