Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in checkError(res) : Undefined error in httr call. httr output: Failed to connect to localhost port 4445: Connection refused

Tags:

docker

r

I try to open a remote driver with RSelenium but I keep on facing the same issue with Docker.

Within Docker I run

$ docker run -d -p 4445:4444 selenium/standalone-firefox:2.53.0

then

$ docker ps

Docker returns

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a89435c68373 selenium/standalone-firefox:2.53.0 "/opt/bin/entry_poin…" About an hour ago Up About an hour 0.0.0.0:4445->4444/tcp determined_sammet

then in R

remDr <- remoteDriver(port = 4445L)
remDr$open()

and I receive this error

Error in checkError(res) : 
  Undefined error in httr call. httr output: Failed to connect to localhost port 4445: Connection refused

I can't figure out how to handle this. Can anyone help? Thanks


Thanks to Ralf Stubner the command

 remDr <- remoteDriver(remoteServerAddr = "yourIP", port = 4445L) 

has fixed my issue

like image 289
J.Demeaux Avatar asked Oct 18 '18 18:10

J.Demeaux


1 Answers

I've found putting a sleep in between seems to help avoid this error:

system("sudo docker pull selenium/standalone-chrome",wait=T)
Sys.sleep(5)
system("sudo docker run -d -p 4445:4444 selenium/standalone-chrome",wait=T)
Sys.sleep(5)
remDr <- remoteDriver(port=4445L, browserName="chrome")
Sys.sleep(15)
remDr$open()
like image 158
Neal Barsch Avatar answered Sep 22 '22 13:09

Neal Barsch