简体   繁体   中英

Rselenium - port 4445: Connection refused

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

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 connectivity on endpoint goofy_newton (a1d52175b212280b1427c3ad77984bfd3826abeeef3bee0b2a9533618a4a712f): Bind for 0.0.0.0:4445 failed: port is already allocated.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM