R: RSelenium 不会启动
R: RSelenium won't start
当我 运行 下面的代码时,弹出错误消息,它不会启动会话。我也在下面包含了版本信息。
提前致谢。
rm(list=ls(all=TRUE))
cat("4")
library(RSelenium)
startServer()
remDr <- remoteDriver(port = 4444,
browserName = "firefox")
remDr$open()[![enter image description here][1]][1]
[1] "Connecting to remote server"
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: org.openqa.selenium.firefox.NotConnectedException
> remDr$getStatus()$build
$version
[1] "2.53.0"
$revision
[1] "35ae25b"
$time
[1] "2016-03-15 17:00:58"
[更新]:我重新安装了我的 firefox (48.0.2),现在当我 运行 相同的代码时,"Firefox has stopped working" 消息消失了,而是打开了一个空白页面,但我在 R 中仍然看到相同的错误消息。请协助,谢谢!
如果您遇到 broser/Selenium 服务器组合无法正常工作的问题,请考虑将 Selenium 与 Docker 结合使用。 Selenium 项目在 https://hub.docker.com/r/selenium/.
处有许多 Docker 个图像可用
在您的情况下,您可以 运行 一个 chrome 调试容器(如果您希望能够使用 VNC 并查看 运行ning 浏览器,请进行调试)。
在您的系统上安装 docker 并发出以下命令行:
$ docker run -d -p 4445:4444 -p 5901:5900 selenium/standalone-chrome-debug:2.53.0
这将在必要时获取图像,然后 运行 容器中的图像。 Selenium 服务器将在主机上的端口 4445 上公开。 Vnc 将在主机上的端口 5901 上公开。
在 windows 上,您可能需要找到 运行ning 容器的 IP 地址。在这种情况下,您可以使用:
$ docker-machine ip
192.168.99.100
在 linux 上相关的 IP 地址将是本地主机。
您可以使用 RSelenium 连接到 运行ning 容器:
# windows with the container ip
remDr <- remoteDriver(remoteServerAddr = "192.168.99.100",
port = 4445L, browserName = "chrome")
# linux
remDr <- remoteDriver(port = 4445L, browserName = "chrome")
remDr$open()
要在容器中查看浏览器,您需要一个 VNC 查看器。有关详细信息,请参阅 RSelenium docker 插图 http://rpubs.com/johndharrison/RSelenium-Docker .
当我 运行 下面的代码时,弹出错误消息,它不会启动会话。我也在下面包含了版本信息。 提前致谢。
rm(list=ls(all=TRUE))
cat("4")
library(RSelenium)
startServer()
remDr <- remoteDriver(port = 4444,
browserName = "firefox")
remDr$open()[![enter image description here][1]][1]
[1] "Connecting to remote server"
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: org.openqa.selenium.firefox.NotConnectedException
> remDr$getStatus()$build
$version
[1] "2.53.0"
$revision
[1] "35ae25b"
$time
[1] "2016-03-15 17:00:58"
[更新]:我重新安装了我的 firefox (48.0.2),现在当我 运行 相同的代码时,"Firefox has stopped working" 消息消失了,而是打开了一个空白页面,但我在 R 中仍然看到相同的错误消息。请协助,谢谢!
如果您遇到 broser/Selenium 服务器组合无法正常工作的问题,请考虑将 Selenium 与 Docker 结合使用。 Selenium 项目在 https://hub.docker.com/r/selenium/.
处有许多 Docker 个图像可用在您的情况下,您可以 运行 一个 chrome 调试容器(如果您希望能够使用 VNC 并查看 运行ning 浏览器,请进行调试)。
在您的系统上安装 docker 并发出以下命令行:
$ docker run -d -p 4445:4444 -p 5901:5900 selenium/standalone-chrome-debug:2.53.0
这将在必要时获取图像,然后 运行 容器中的图像。 Selenium 服务器将在主机上的端口 4445 上公开。 Vnc 将在主机上的端口 5901 上公开。
在 windows 上,您可能需要找到 运行ning 容器的 IP 地址。在这种情况下,您可以使用:
$ docker-machine ip
192.168.99.100
在 linux 上相关的 IP 地址将是本地主机。
您可以使用 RSelenium 连接到 运行ning 容器:
# windows with the container ip
remDr <- remoteDriver(remoteServerAddr = "192.168.99.100",
port = 4445L, browserName = "chrome")
# linux
remDr <- remoteDriver(port = 4445L, browserName = "chrome")
remDr$open()
要在容器中查看浏览器,您需要一个 VNC 查看器。有关详细信息,请参阅 RSelenium docker 插图 http://rpubs.com/johndharrison/RSelenium-Docker .