[英]Rselenium - port 4445: Connection refused
我想使用 R Selenium 进行一些网络抓取,但是出现连接错误。 看看一个简单的代码和输出:
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。 我正在使用 ToolBox for Win 8.1
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.
在我看来,您映射的端口已经绑定到某个进程。 建议您使用netstat
帮助并确定哪个进程占用了端口。 终止进程并再次尝试运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.