我正在尝试将 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:连接被拒绝"?
发布评论