0

I am trying to make use of RSelenium, but am running into the following error when trying to launch the remote driver. Any suggestions on what I need to fix would be highly appreciated,

library(RSelenium)
RSelenium::checkForServer()
RSelenium::startServer()
require(RSelenium)

system("defaults write org.R-project.R force.LANG en_US.UTF-8")
remote.driver <- remoteDriver(remoteServerAddr = "localhost" , port = 4455, browserName = "firefox")
startServer(args = c("-port 4455"), log = FALSE, invisible = FALSE)
remote.driver$open()

>[1] "Connecting to remote server"
Error:   Summary: UnknownError
     Detail: An unknown server-side error occurred while processing the command.
     class: java.util.zip.ZipException

My session details are the below

>system("java -version")
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

>sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RSelenium_1.3.5 XML_3.98-1.3    RJSONIO_1.3-0   RCurl_1.95-4.6  bitops_1.0-6   

loaded via a namespace (and not attached):
[1] tools_3.2.0    caTools_1.17.1
user229044
  • 232,980
  • 40
  • 330
  • 338
JSB
  • 351
  • 2
  • 24

1 Answers1

2

Try first to stop both servers:

browseURL("http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer")
browseURL("http://localhost:4455/selenium-server/driver/?cmd=shutDownSeleniumServer")

And then: Open the Server on the port you try to connect as follows (see
?RSelenium::startServer())

startServer()
# example of commandline passing
startServer(args = c("-port 4455"), log = FALSE, invisible = FALSE)
remDr <- remoteDriver(browserName = "firefox", port = 4455)
remDr$open()

What i guess is wrong about your code:
I think you are running the commands in the wrong order.

You do start a Selenium Server on Port 4444 (RSelenium::startServer() your 3rd line - This defaults to port = 4444.) Then you try to run a remote driver on Port 4455 (your line 6)

remote.driver <- remoteDriver(remoteServerAddr = "localhost" , port = 4455, browserName = "firefox")

And after trying to open a connection on a wrong port you finally start the Server on Port 4455 (your line 7).

Rentrop
  • 20,979
  • 10
  • 72
  • 100
  • Your solution worked; unclear why i was able to get the original code to work up until now though. – JSB Jan 01 '16 at 03:11