简体   繁体   中英

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

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

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()

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