繁体   English   中英

R RSelenium/seleniumPipes 未知错误:找不到 Chrome 二进制文件

[英]R RSelenium/seleniumPipes Unknown error: cannot find Chrome binary

我尝试在 Win10 上使用 Chrome 浏览器连接 R 中的 Selenium。

我安装了 Chrome 74.0.3729.61 并将 chrome.exe 路径添加到环境变量中。

devtools::install_github("johndharrison/seleniumPipes")
devtools::install_github("ropensci/Rselenium")

#start selenium
selServ <- selenium()
# check ports
selServ$log()$stderr 
# conect using port
sel <- remoteDr(browserName = "chrome", port = 4567)

给我以下错误消息:

Called  newSession  - Try no:  1  of  3 

Called  newSession  - Try no:  2  of  3 

Called  newSession  - Try no:  3  of  3 
Error detected:
Response status code : 500 
Selenium Status code:  13 
Selenium Status summary:  UnknownError 
Selenium Status detail:  An unknown server-side error occurred while processing the command. 
Selenium message:  unknown error: cannot find Chrome binary
  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 40 milliseconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: ... , os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_201'
Driver info: driver.version: unknown 
Please check the response with errorResponse()
Please check the content returned with errorContent()

我找到了一些关于 Python( 无法在旧版本的 Google Chrome 中使用 Selenium 在 Python 中找到 Chrome 二进制文件)和 c#( Selenium WebDriver - 找不到 Chrome 二进制文件)的指导,但是,我不知道如何在 R 中实现它。

恕我直言,在使用 selenium 之前,您需要下载并运行 chomedriver.exe(如果您使用的是 Windows 10,正如您所提到的)。
您可以尝试以下解决方案吗?

解决方案1.在命令窗口

java -Dwebdriver.chrome.driver="C:/{yourPath}/selenium/chromedriver.exe" -jar "C:/{yourPath}/selenium/selenium-server-standalone-3.141.59.jar" -port 4567

或者

解决方案2.直接使用R脚本

rstudioapi::terminalExecute('java -Dwebdriver.chrome.driver="C:/{yourPath}/selenium/chromedriver.exe" -jar "C:/{yourPath}/selenium/selenium-server-standalone-3.141.59.jar" -port 4567')

是的,两者都是相同的命令。 你可以使用任何你想要的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM