RSelenium : connection refused error

懵懂的女人 提交于 2019-12-24 03:37:07

问题


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?


回答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.



来源:https://stackoverflow.com/questions/46028200/rselenium-connection-refused-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!