curious_bitcoiner
curious_bitcoiner

Reputation: 21

RSelenium : connection refused error

I'm trying to connect to Selenium server using the most recent version of RSelenium. Here is the code I used:

install.packages('RSelenium')
library(RSelenium)
remDr <- remoteDriver(remoteServerAddr = "localhost" 
                      , port = 4445L
                      , browserName = "firefox"
)
remDr$open()

The output is as follows:

Error in checkError(res) : 
  Undefined error in httr call. httr output: Failed to connect to localhost port 4445: Connection refused

I have tried this solution (using the docker). I downloaded the docker from here (as I am using macOS 10.12.5) and added the executable to PATH. After running this code:

system('docker run -d -p 4445:4444 selenium/standalone-chrome')

I get this output:

docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

I have tried some other solutions but none of them worked. Can you help me please?

Upvotes: 2

Views: 6240

Answers (1)

Victor Burnett
Victor Burnett

Reputation: 628

You need administrator privileges to run a docker container, you can't do this inside an R Script unless it's run with administrator privileges. This goes for Windows or Mac users.

My recommendation is to run the command

docker run -d -p 4445:4444 selenium/standalone-chrome

inside a command-line shell you have opened with admin privileges.

Upvotes: 1

Related Questions