【问题标题】:R RSelenium/seleniumPipes Unknown error: cannot find Chrome binaryR RSelenium/seleniumPipes 未知错误:找不到 Chrome 二进制文件
【发布时间】:2019-04-09 15:16:32
【问题描述】:

我尝试在 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 (Cannot find Chrome binary with Selenium in Python for older versions of Google Chrome) 和 c# (Selenium WebDriver - Could not find Chrome binary) 的指南,但是我不知道如何在 R 中实现它。

【问题讨论】:

    标签: r selenium selenium-chromedriver rselenium


    【解决方案1】:

    恕我直言,您需要先下载并运行 chomedriver.exe(如果您使用的是 Windows 10,如您所述)才能使用 selenium。
    您可以尝试以下解决方案吗?

    解决方案 1. 在命令窗口中

    java -Dwebdriver.chrome.driver="C:/{yourPath}/selenium/chromedriver.exe" -jar "C:/{yourPath}/selenium/selenium-server-standalone-3.141.59.jar" - 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')
    

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

    【讨论】:

    • 感谢您的宝贵时间。我下载了 chromedriver.exe 和 selenium-server-standalone,并在我的路径中使用了你的 R 脚本。但是,我得到了同样的错误。
    猜你喜欢
    • 2018-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-06
    • 2021-04-02
    • 2018-02-12
    • 2017-04-09
    • 2021-07-18
    相关资源
    最近更新 更多