I am trying to open a remote driver using the RSelenium package with Chrome driver and encountering the following error:
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: java.lang.IllegalStateException
This question has been asked previous on stackoverflow, but the solution (which I tried in full) did not work. I also consulted this and this.
My basic code in R is as follows. The error occurs after the following line remDr$open()
.
install.packages("RSelenium")
library(RSelenium)
checkForServer()
startServer()
Sys.sleep(5.0)
remDr <- remoteDriver( browserName="chrome" )
remDr$open()
Specs:
- R: v.3.3.0
- Working in R with RStudio v.0.99.902
- OS: OSX El Capital 10.11.3
- Java: 1.8.92.14
- I also downloaded the chrome driver v2.21 here. It's currently living in its own folder within Applications.
To fix this problem I have tried:
- Two alternative versions of the
startServer()
command below. The first threw the same error, the second also told meNo Selenium Server binary exists. Run checkForServer or start server manually.
startServer(args = c("-Dwebdriver.chrome.driver=/mypath/to/chromedriver.exe") , log = FALSE, invisible = FALSE)
- and
startServer(dir = FALSE, args = c("-Dwebdriver.chrome.driver=/mypath/to/chromedriver.exe") , log = FALSE, invisible = FALSE)
- Running the following in the terminal (and leaving the terminal open while running the R code):
java -jar /mypath/to/selenium-server-standalone.jar -Dwebdriver.chrome.driver=/mypath/to/chromedriver.exe
. This threw the same error. - Creating a
.command
file that contains the information I previously entered into the terminal above (2) and calling that file within R as below.
.
install.packages("RSelenium")
library(RSelenium)
system(paste("open","/mypath/command.command")
remDr <- remoteDriver( browserName="chrome" )
remDr$open()
This resulted in the following error The file could not be executed because you do not have appropriate access privileges.
Navigating to the .command file in Finder and changing all of the Sharing & Permissions to Read & Write did not change the error message.
Reinstalling all components - Chrome Driver, Selenium
.jar
file, packageRSelenium
. Restarting R. Updating R and RStudio.Using a default remote driver (Firefox, I believe) like this
remDr <- remoteDriver$new()
. Different error:class: org.openqa.selenium.WebDriverException
.Updating Firefox to help with 5 above to no avail.
Help would be appreciated.