如何解决RSelenium错误消息“无法连接到本地主机端口4444:连接被拒绝"? [英] How to resolve RSelenium error message "Failed to connect to localhost port 4444: Connection refused"?

查看:249
本文介绍了如何解决RSelenium错误消息“无法连接到本地主机端口4444:连接被拒绝"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 RSelenium Docker 一起使用来爬网网站.但是,在尝试使 RSelenium / Docker 正常工作时,我遇到了一些问题.

I am trying to use RSelenium with Dockerto crawl a website. However, I have some issues trying to get RSelenium/Docker to work.

具体地说,我在计算机上安装了 Docker ,它似乎运行良好(打开鲸鱼时,我在下面看到它的图像).

Specifically, I installed Docker on my computer, which appears to be running fine (I see the image of the whale below when I open it).

然后在R中,我可以毫无问题地运行以下代码,并查看预期的输出.

In R, I then run the following code with no problems and see the expected output.

shell('docker run -d -p 4445:4444 selenium/standalone-chrome')
shell('docker ps')
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                    NAMES
d7de815ce644        selenium/standalone-chrome   "/opt/bin/entry_poin…"   13 minutes ago      Up 13 minutes       0.0.0.0:4445->4444/tcp   zen_mclean

但是当我随后运行以下代码时,我总是收到以下错误消息:

But when I then run the following code, I always receive the following error message:

remDr <- RSelenium::remoteDriver(remoteServerAddr = "localhost",
                             port = 4444,
                             browserName = "chrome")
remDr$open()
[1] "Connecting to remote server"
Error in checkError(res) : 
  Undefined error in httr call. httr output: Failed to connect to localhost port 4444: Connection refused

我不确定这是怎么回事(我是刮刮的新手).有人可以帮我弄清楚该怎么办吗?

I am not sure what is going on here (I'm new to scraping). Can anybody help me figure out what to do here?

如果有帮助,我正在运行Windows 10.

If it helps, I am running Windows 10.

推荐答案

我设法通过卸载正在使用的Docker Toolbox和VMBox并从其网站上安装了最新版本的Docker来解决了这个问题.

I managed to solve the problem by uninstalling Docker Toolbox and VMBox, which I was using, and installing the latest version of Docker from their website instead.

这篇关于如何解决RSelenium错误消息“无法连接到本地主机端口4444:连接被拒绝"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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