0

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

Mikołaj
  • 385
  • 4
  • 17

1 Answers1

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.

piy26
  • 1,574
  • 11
  • 21
  • Ok I am getting. Could you explain me why I can only type in cmd broken bar "¦" instead of vertical line "|" ? I cannot type proper netstat | find "4445" command. – Mikołaj Aug 03 '18 at 08:53
  • I am not sure about that but as far as I know its how the terminal shows you that character may be something to do with the charset settings for your terminal. But what remains is the idea to pipe the output of your netstat command to the find command. – piy26 Aug 05 '18 at 13:31