1

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!

Ogre Magi
  • 1,445
  • 3
  • 13
  • 14
  • 1
    I once had a similar problem. Solved it with `unlink(system.file("bin", package = "RSelenium"), recursive = T); checkForServer()`. Have a look at http://stackoverflow.com/questions/29684015/rselenium-error-notconnectedexception It's likely caused by firefox updating at a higher pace than RSelenium. – PavoDive Aug 29 '16 at 18:57
  • Thanks, but it didn't work. I reinstalled firefox and was able to open a session but then it gives me the same error msg in R. And I've tried your suggestions. – Ogre Magi Aug 29 '16 at 19:33
  • Use docker containers. Your browser will be compatible with your version of Selenium Server see http://rpubs.com/johndharrison/RSelenium-Docker. Firefox 48+ needs the gecko driver to run plus Selenium 3.0 see https://github.com/ropensci/RSelenium/issues/81. – jdharrison Aug 29 '16 at 19:33
  • @jdharrison, thanks for your suggestion. I've installed and loaded docker toolbox and it assigned a key to me. Not sure what the next step is... Should I also get the webdriver? – Ogre Magi Aug 29 '16 at 19:58
  • Read the Docker vignette ( http://rpubs.com/johndharrison/RSelenium-Docker ). It takes you through what to do on windows and linux. You basically just need to install docker and run a docker image from Selenium such as https://hub.docker.com/r/selenium/standalone-chrome-debug/. It contains an appropriate version of selenium server plus an appropriate browser. – jdharrison Aug 29 '16 at 20:04
  • @jdharrison, will read. Can you move your answer to an actual answer, so that I can accept and close this issue? Thanks! – Ogre Magi Aug 29 '16 at 20:09
  • @jdharrison, I followed all the way through the tutorial and can get that "Google" Title working for me (no more errors, yay). But I don't see selenium literally opens the webpage like it used to? Is that true? Thanks! – Ogre Magi Aug 29 '16 at 21:52
  • The browser is opened headless in the Docker container. If you are running a "debug" image you can see the browser with a VNC viewer. This is detailed at the end of the vignette. – jdharrison Aug 30 '16 at 08:00
  • @jdharrison,got it, didn't know what a vnc viewer is so skipped that paragraph :-) – Ogre Magi Aug 30 '16 at 13:32
  • @jdharrison, I use Rselenium with Firefox, and downloaded a pdf from the webpage. I can see this file in TightVNC viewer in its download folder but I don't know how to save it to my computer? Do you know how? Thanks! – Ogre Magi Aug 31 '16 at 15:12

1 Answers1

1

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 .

jdharrison
  • 30,085
  • 4
  • 77
  • 89