RSelenium:连接被拒绝错误 [英] RSelenium : connection refused error

查看:73
本文介绍了RSelenium:连接被拒绝错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用最新版本的RSelenium连接到Selenium服务器.这是我使用的代码:

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()

输出如下:

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

我尝试了此解决方案(使用docker).我从此处下载了docker(因为我使用的是macOS 10.12.5),并且将可执行文件添加到PATH.运行此代码后:

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')

我得到以下输出:

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?

推荐答案

您需要管理员权限才能运行Docker容器,除非在R Script中以管理员权限运行,否则您无法在R脚本中执行此操作.这适用于Windows或Mac用户.

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.

我的建议是运行命令

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

以管理员权限打开的命令行外壳内部.

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

这篇关于RSelenium:连接被拒绝错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆