Ogre Magi
Ogre Magi

Reputation: 1535

R: RSelenium won't start

When I run the code below, the error msg pops up and it won't start the session. I have included the version infor below too. Thanks in advance.

enter image description here

rm(list=ls(all=TRUE))
cat("\014")
library(RSelenium)
startServer()
remDr <- remoteDriver(port = 4444,
                      browserName = "firefox") 
remDr$open()[![enter image description here][1]][1]



[1] "Connecting to remote server"
Error:   Summary: UnknownError
     Detail: An unknown server-side error occurred while processing the command.
     class: org.openqa.selenium.firefox.NotConnectedException


> remDr$getStatus()$build
$version
[1] "2.53.0"

$revision
[1] "35ae25b"

$time
[1] "2016-03-15 17:00:58"

[UPDATE]: I reinstalled my firefox (48.0.2) , now when I run the same code, the "Firefox has stopped working" msg is gone, instead it opens a blank page, but I still see the same error msg in R. Please assist, thanks!

Upvotes: 1

Views: 1435

Answers (1)

jdharrison
jdharrison

Reputation: 30465

If you have issues with a broser/Selenium Server combination not working consider using Selenium with Docker. The Selenium project have a number of Docker images available at https://hub.docker.com/r/selenium/.

In your case you could run a chrome debug container (debug if you want to be able to VNC and view the running browser).

Install docker on your system and issue the following commandline:

$ docker run -d -p 4445:4444 -p 5901:5900 selenium/standalone-chrome-debug:2.53.0

This will source the image if necessary then run the image in a container. The Selenium server will be exposed on port 4445 on the host. Vnc will be exposed on port 5901 on the host.

On windows you may need to find the ip address of the running container. In such a case you can use:

$ docker-machine ip 192.168.99.100

On linux the relevant ip address would be localhost.

You can connect to your running container with RSelenium:

# windows with the container ip
remDr <- remoteDriver(remoteServerAddr = "192.168.99.100",
                       port = 4445L, browserName = "chrome")
# linux 
remDr <- remoteDriver(port = 4445L, browserName = "chrome")
remDr$open()

To view the browser in the container you will need a VNC viewer. See the RSelenium docker vignette for more details http://rpubs.com/johndharrison/RSelenium-Docker .

Upvotes: 1

Related Questions