如何解决RSelenium错误消息“无法连接到本地主机端口4444:连接被拒绝"?

编程入门 行业动态 更新时间:2024-10-26 18:16:35
本文介绍了如何解决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:连接被拒绝"?

本文发布于:2023-06-05 01:12:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/508799.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何解决   连接到   端口   被拒   错误

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!