1

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.

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your time. I downloaded the chromedriver.exe and the selenium-server-standalone and used your R script with my paths. However, I get the same error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.