简体   繁体   中英

R RSelenium/seleniumPipes Unknown error: cannot find Chrome binary

I try to connect with Selenium in R using the Chrome browser on Win10.

I installed Chrome 74.0.3729.61 and added the chrome.exe path to the Environment Variables.

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)

gives me the following error message:

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()

I found some guidance for Python ( Cannot find Chrome binary with Selenium in Python for older versions of Google Chrome ) and c# ( Selenium WebDriver - Could not find Chrome binary ), however, I do not know how to implement it in R.

IMHO you need to download and run chomedriver.exe(if you are using Windows 10, as you mentioned) before to use selenium.
Could you try below solution?

Solution 1. on command window

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

or

Solution 2. direct use R script

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

Yes, both are same command exactly. You are able to use anyone you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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