我正在尝试使用最新版本的 RSelenium 连接到 Selenium 服务器。这是我使用的代码:
install.packages('RSelenium')
library(RSelenium)
remDr <- remoteDriver(remoteServerAddr = "localhost"
, port = 4445L
, browserName = "firefox"
)
remDr$open()
输出如下:
Error in checkError(res) :
Undefined error in httr call. httr output: Failed to connect to localhost port 4445: Connection refused
我努力了这个解决方案 https://stackoverflow.com/questions/45395849/cant-execute-rsdriver-connection-refused(使用泊坞窗)。我从下载了dockerhere https://download.docker.com/mac/static/stable/(因为我使用的是 macOS 10.12.5)并将可执行文件添加到 PATH 中。运行此代码后:
system('docker run -d -p 4445:4444 selenium/standalone-chrome')
我得到这个输出:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
我尝试过其他一些解决方案,但没有一个有效。你能帮我吗?
您需要管理员权限才能运行 docker 容器,除非以管理员权限运行,否则无法在 R 脚本内执行此操作。这适用于 Windows 或 Mac 用户。
我的建议是运行命令
docker run -d -p 4445:4444 selenium/standalone-chrome
在您以管理员权限打开的命令行 shell 中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)