【问题标题】:RSelenium : connection refused errorRSelenium:连接被拒绝错误
【发布时间】:2017-09-03 22:04:00
【问题描述】:

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

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

我已经尝试过this solution(使用 docker)。我从here 下载了 docker(因为我使用的是 macOS 10.12.5)并将可执行文件添加到 PATH。运行此代码后:

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?.

我尝试了其他一些解决方案,但都没有奏效。你能帮帮我吗?

【问题讨论】:

标签: r docker web-scraping rselenium


【解决方案1】:

您需要管理员权限才能运行 docker 容器,您不能在 R 脚本中执行此操作,除非它以管理员权限运行。这适用于 Windows 或 Mac 用户。

我的建议是运行命令

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

在您以管理员权限打开的命令行 shell 中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-18
    • 2016-12-09
    • 2018-04-21
    相关资源
    最近更新 更多