Rselenium - 端口 4445:连接被拒绝 [英] Rselenium - port 4445: Connection refused
问题描述
我想使用 R Selenium 进行一些网络抓取,但是出现连接错误.看看一个简单的代码和输出:
I want to use R Selenium for some web-scraping however I got a connection error. Have a look on a simple code and output:
library(devtools)
library(XML)
library(caTools)
library(binman)
library(wdman)
library(yaml)
library(wdman)
library(RSelenium)
> system('docker pull selenium/standalone-firefox')
Using default tag: latest
latest: Pulling from selenium/standalone-firefox
Digest: sha256:fcb896e8764e09af9e292e7acf2fc86030894ec667871086b5fe60704a82984d
Status: Image is up to date for selenium/standalone-firefox:latest
> system('docker run -d -p 4445:4444 selenium/standalone-firefox')
5d8ffbe34b8ede1d43dbf129ac1fed1cea1fdeadf314029e610d1ee0ac3c2562
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: driver failed programming external connectivity on endpoint goofy_newton (a1d52175b212280b1427c3ad77984bfd3826abeeef3bee0b2a9533618a4a712f): Bind for 0.0.0.0:4445 failed: port is already allocated.
> remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox")
> remDr$open()
[1] "Connecting to remote server"
Error in checkError(res) :
Undefined error in httr call. httr output: Failed to connect to localhost port 4445: Connection refused
> remDr$navigate("http://www.google.com")
Error in checkError(res) :
Undefined error in httr call. httr output: length(url) == 1 is not TRUE
> remDr$getTitle()
Error in checkError(res) :
Undefined error in httr call. httr output: length(url) == 1 is not TRUE
我该如何处理这个错误?Docker Toolbox 配置为使用我的 IP.我使用的是 Win 8.1 的 ToolBox
How shall I deal with this Error? Docker Toolbox is configured to use my IP. I am using ToolBox for Win 8.1
推荐答案
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: driver failed programming external connected on endpoint goofy_newton (a1d52175b212280b1427c3ad77984bfd3826abeef2618a3826abeeef261838e4)绑定 0.0.0.0:4445 失败:端口已分配.
在我看来,您正在映射的端口已经绑定到某个进程.建议您使用 netstat
帮助并确定哪个进程占用了端口.终止进程并再次尝试运行.
Seems to me that the port you are mapping with is already bound to some process. Suggest you to take the netstat
help and determine which process is holding onto the port. Kill the process and try running again.
这篇关于Rselenium - 端口 4445:连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!