2

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?

4
  • It's a bit easier to use the included functions to run PhantomJS than Firefox/whatever. Commented Sep 3, 2017 at 22:33
  • Give splashr a try — cran.r-project.org/web/packages/splashr/index.html & github.com/hrbrmstr/splashr. It's an alternative to the Selenium ecosystem based on splash.readthedocs.io/en/stable Commented Sep 3, 2017 at 23:47
  • Having said that, did you install Docker from docker.com/docker-mac and did you verify the Docker "hello world" example works before attempting to use Selenium? Commented Sep 3, 2017 at 23:48
  • 1
    Your docker daemon isn't running. No issue with selenium. May be docker needs sudo user privileges. Try that! Commented Sep 4, 2017 at 3:10

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.