我正在使用chromedriver 2.35和chrome浏览器64和selenium 3.9。 我的脚本正在运行但现在显示错误... 浏览器启动并刚刚关闭..
我的脚本是
System.setProperty("webdriver.chrome.driver","//Users//vikas//Downloads//chromedriver");
WebDriver driver = new ChromeDriver();
driver.get("https://google.com");
错误日志:
Starting ChromeDriver 2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef) on port 44554
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created exception
from disconnected: unable to connect to renderer
(Session info: chrome=64.0.3282.167)
(Driver info: chromedriver=2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef),platform=Mac OS X 10.11.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 3.89 seconds
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:28.403Z'
System info: host: 'vikass-MacBook-Pro.local', ip: '10.1.1.234', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.5', java.version: '9.0.4'
Driver info: driver.version: ChromeDriver
答案 0 :(得分:0)
今天有这个问题。已更新为最新 chrome 64(即使已经有64个更新了),它也开始工作了。但是现在我有几个测试因为奇怪的超时而崩溃。也许还需要更新Selenium ......
答案 1 :(得分:0)
请检查兼容的Selenium Webdriver并使用以下代码并尝试:
System.setProperty("webdriver.chrome.driver","C:/Users//vikas//Downloads//chromedriver.exe");
WebDriver driver = new ChromeDriver();
答案 2 :(得分:-1)
使用以下代码:
String path = "D:\\chromedriver.exe";
System.setProperty("webdriver.chrome.driver", path);
WebDriver driver = new ChromeDriver();
driver.get("https://google.com");