本文介绍了checkError(res)中的错误:httr调用中未定义的错误。 httr输出:无法连接到本地主机端口4445:连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用RSelenium打开一个远程驱动程序,但是我仍然面对Docker的相同问题。
I try to open a remote driver with RSelenium but I keep on facing the same issue with Docker.
在Docker内运行
$ docker run -d -p 4445:4444 selenium/standalone-firefox:2.53.0
然后
$ docker ps
Docker返回
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
然后在R
remDr <- remoteDriver(port = 4445L)
remDr$open()
,我收到此错误
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
感谢Ralf Stubner命令
Thanks to Ralf Stubner the command
remDr <- remoteDriver(remoteServerAddr = "yourIP", port = 4445L)
已解决我的问题
推荐答案
我发现在两者之间进行睡眠似乎有助于避免此错误:
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()
这篇关于checkError(res)中的错误:httr调用中未定义的错误。 httr输出:无法连接到本地主机端口4445:连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!