Reputation: 2886
I am trying to use Rselenium
to automate some of my more tedious reporting tasks
I have downloaded the Java virtual machine as per the instructions I have gotten it running by using the code below
# Run the Command at the command line
cd selenium
java -jar selenium-server-standalone-3.0.1.jar
In R i then add the following code
require(RSelenium)
remDr <- remoteDriver(remoteServerAddr = "localhost"
, port = 4445L
, browserName = "firefox"
)
remDr <- remoteDriver(port = 4445L)
remDr$open()
When i run the last line i get the error
[1] "Connecting to remote server" Error in checkError(res) : Couldnt connect to host on http://localhost:4445/wd/hub. Please ensure a Selenium server is running.
I can see in the command line window that the server is running as i am getting the message Selenium Server is up and Running
Can anyone see what I'm doing incorrectly?
I have tried switching the port to 4444 as based on the advice below but i get the error
From the Cmd Prompt
Selenium message:The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases
From R
Error: Summary: UnknownError Detail: An unknown server-side error occurred while processing the command. class: java.lang.IllegalStateException Further Details: run errorDetails method
Upvotes: 1
Views: 5815
Reputation: 30425
From Firefox version 48 the gecko driver is also required to drive a Firefox browser with Selenium Server. The geckodriver can be downloaded at https://github.com/mozilla/geckodriver/releases. If you wish to run the Selenium server manually you should then either
The second method would be done as:
java -Dwebdriver.gecko.driver="path-to-geckodriver" -jar selenium-server-standalone-3.0.1.jar
If you are running windows and have downloaded the Selenium standalone to C:\Selenium
and the geckodriver to the same location then this would look like:
C:\Users\john>cd C:\Selenium
C:\Selenium>java -Dwebdriver.gecko.driver="C:\Selenium\geckodriver.exe" -jar selenium-server-standalone-3.0.1.jar
NOTE: on a 32bit windows machine you will need the 32bit geckodriver and on a 64bit machine the corresponding 64bit geckodriver.
Alternatively the recommended way to run a Selenium server with RSelenium is to run a Docker container which includes the Selenium Server, geckodriver and appropriate Firefox browser:
docker run -d -p 5901:5900 -p 127.0.0.1:4444:4444 --link http-server selenium/standalone-firefox-debug:3.0.1-barium
see the vignette at http://rpubs.com/johndharrison/RSelenium-Docker
Upvotes: 4