我正在尝试在Selenium中使用ChromeDriver,但Chrome"无法启动。"有什么东西可能我可能做错了吗?谢谢!
我的代码:
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Bill\\Desktop\\StockBot Workspace\\Files\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com");
}
在控制台中输出什么:
Starting ChromeDriver 2.12.301325 (962dea43ddd90e7e4224a03fa3c36a421281abb7) on port 50099
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: chrome failed to start
(Driver info: chromedriver=2.12.301325 (962dea43ddd90e7e4224a03fa3c36a421281abb7),platform=Windows NT 10.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 707 milliseconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:55:52'
System info: host: 'Zeus', ip: '192.168.7.103', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:159)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:116)
at Runner.main(Runner.java:7)
答案 0 :(得分:1)
卸载chrome
从目录C:\ Users ____ \ AppData \ Local \ Google \ chrome
重新安装chrome
我有同样的错误,这对我有用。
2014年8月29日8:11在PawełAdamski的stackoverflow上回答 ChromeWebDriver - unknown error: Chrome failed to start: crashed
答案 1 :(得分:0)
尝试卸载计算机上的Chrome浏览器。然后删除chrome用户个人资料。
重新安装chrome并检查它是否有效。之前有这个问题,为我工作过。