3

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:

  1. Two alternative versions of the startServer() command below. The first threw the same error, the second also told me No 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)
  2. 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.
  3. 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.

  1. Reinstalling all components - Chrome Driver, Selenium .jar file, package RSelenium. Restarting R. Updating R and RStudio.

  2. Using a default remote driver (Firefox, I believe) like this remDr <- remoteDriver$new(). Different error: class: org.openqa.selenium.WebDriverException.

  3. Updating Firefox to help with 5 above to no avail.

Help would be appreciated.

Community
  • 1
  • 1
  • No idea, but seems like you were very thorough in trying fixes. – nick_eu Jun 02 '16 at 22:57
  • I get same error on windows. Use `startServer(log = FALSE, invisible = FALSE)` to have the server console open then you can get errors. It works fine with firefox – HubertL Jun 02 '16 at 23:25
  • Thanks! I tried that (both with Chrome and Firefox). I don't get a "server console" to open (unsure quite what that means), though I get a different error: `org.openqa.selenium.WebDriverException`. @HubertL – user2489854 Jun 02 '16 at 23:50

2 Answers2

0

Breaking the rules here asking for clarification. But this problem is driving my crazy. Could you list the versions of everything you used when you got it working.

For me:

R 3.3.0 GUI 1.68 Mavericks build

RStudio Version 0.99.902

OSX El Capital 10.11.5

Java: 1.8.0_91

selenium-server-standalone-2.53.1.jar

FF 47.0 (and also tried FF 46.0)

still lead to org.openqa.selenium.firefox.NotConnectedException

Jimmy
  • 1
  • 1
  • 1
  • 5
  • Sure. The versions are the same as I posted in the initial question. The only difference is that I stopped trying to use the Chrome driver and got it to work with a Firefox driver. Though I didn't get clarification on what was going on through this post, someone else (in real life) suggested that (a) using Firefox is better since this is the default for RSelenium and doesn't require installing a new driver, and (b) that closing your port (even if you don't think you opened a port) is important. Finally, I didn't receive the same error as yours, so you might be dealing with other issues. – user2489854 Jul 07 '16 at 14:38
  • Thanks for the response. I finally fixed it for me. Needed FF45. – Jimmy Jul 07 '16 at 15:56
  • Im also having problems, how did you fix it? – Cyrus Mohammadian Aug 09 '16 at 03:21
-1

The following solved the problem:

checkForServer()              
startServer( args = c( "-port 4455" ), log = FALSE, invisible = FALSE )
remDr <- remoteDriver( browserName="firefox", port=4455 )            
remDr$open( silent=T ) 

I am not sure why it worked (and perhaps someone can answer that), but this did the trick.