使用RSelenium打开Chrome浏览器,得到“无法创建新服务:ChromeDriverService”消息和错误

时间:2018-09-18 21:19:08

标签: r google-chrome selenium-chromedriver rselenium

正如标题所述,我有一个使用RSelenium编写的脚本,用于使用chrome作为浏览器来自动化Web导航。这个脚本已经运行了好几个月了,但是今天当我尝试运行它时,我收到了以下消息:

Selenium message:Unable to create new service: ChromeDriverService
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08- 
02T20:13:22.693Z'
System info: host: 'LAPTOP-22QM8890', ip: '192.168.133.65', os.name: 
'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171'
Driver info: driver.version: unknown

Could not open chrome browser.
Client error message:
 Summary: SessionNotCreatedException
 Detail: A new session could not be created.
 Further Details: run errorDetails method
Check server log for further details.

我很确定我已经安装了最新版本的Chrome和ChromeDriver,但这并没有改变任何内容。我不知道今天是什么原因导致此错误自发出现。

1 个答案:

答案 0 :(得分:1)

如果您使用的是Windows,只需进入C:\ Users \ Jeff \ AppData \ Local \ binman并删除其中的所有目录(对我来说,包括seleniumserver和geckodriver在内的4个目录)。然后只需打开RStudio并运行例如

library(RSelenium)
rD <- rsDriver(browser = "chrome")
remDr <- rD$client
remDr$navigate("https://google.com")

祝你好运。