Selenium 如何在webdriver中自动化chrome浏览器?我犯了一个错误

Selenium 如何在webdriver中自动化chrome浏览器?我犯了一个错误,selenium,selenium-webdriver,Selenium,Selenium Webdriver,运行此方法会引发错误“[4032:519:0701/155158:error:process\u singleton\u mac.cc(106)]无法获得配置文件锁定。”从下载ChromeDriver.exe,然后将系统属性添加为 public void chrome(){ System.setProperty("webdriver.chrome.driver", "/Applications/Google Chrome.app/Contents/MacOS/GoogleChrome");

运行此方法会引发错误“[4032:519:0701/155158:error:process\u singleton\u mac.cc(106)]无法获得配置文件锁定。”

从下载ChromeDriver.exe,然后将系统属性添加为

 public void chrome(){

System.setProperty("webdriver.chrome.driver", "/Applications/Google Chrome.app/Contents/MacOS/GoogleChrome"); //Chrome
driver = new ChromeDriver();
driver.get(baseUrl);
System.out.println(driver.getTitle());
driver.close();
driver.quit();
}
chromedriver.exe文件的路径应正确。
希望对您有所帮助。

从下载ChromeDriver.exe,然后添加系统属性作为

 public void chrome(){

System.setProperty("webdriver.chrome.driver", "/Applications/Google Chrome.app/Contents/MacOS/GoogleChrome"); //Chrome
driver = new ChromeDriver();
driver.get(baseUrl);
System.out.println(driver.getTitle());
driver.close();
driver.quit();
}
chromedriver.exe文件的路径应正确。
希望对您有所帮助。

在创建ChromeDriver实例之前,您需要设置ChromeDriver的路径

System.setProperty("webdriver.chrome.driver", "...\chromedriver.exe");
driver = new ChromeDriver();
从下面的位置下载chromedriver


在创建ChromeDriver实例之前,需要设置ChromeDriver的路径

System.setProperty("webdriver.chrome.driver", "...\chromedriver.exe");
driver = new ChromeDriver();
从下面的位置下载chromedriver


这是最好的答案+这是最好的答案+1给你