RSelenium ZipException错误

时间:2015-12-25 15:01:32

标签: r selenium rselenium

我正在尝试使用RSelenium,但在尝试启动远程驱动程序时遇到以下错误。任何有关我需要修复的建议都将受到高度赞赏,

library(RSelenium)
RSelenium::checkForServer()
RSelenium::startServer()
require(RSelenium)

system("defaults write org.R-project.R force.LANG en_US.UTF-8")
remote.driver <- remoteDriver(remoteServerAddr = "localhost" , port = 4455, browserName = "firefox")
startServer(args = c("-port 4455"), log = FALSE, invisible = FALSE)
remote.driver$open()

>[1] "Connecting to remote server"
Error:   Summary: UnknownError
     Detail: An unknown server-side error occurred while processing the command.
     class: java.util.zip.ZipException

我的会议详情如下

>system("java -version")
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

>sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RSelenium_1.3.5 XML_3.98-1.3    RJSONIO_1.3-0   RCurl_1.95-4.6  bitops_1.0-6   

loaded via a namespace (and not attached):
[1] tools_3.2.0    caTools_1.17.1

1 个答案:

答案 0 :(得分:2)

首先尝试停止两台服务器:

browseURL("http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer")
browseURL("http://localhost:4455/selenium-server/driver/?cmd=shutDownSeleniumServer")

然后:在您尝试连接的端口上打开服务器,如下所示(请参阅
?RSelenium::startServer()

startServer()
# example of commandline passing
startServer(args = c("-port 4455"), log = FALSE, invisible = FALSE)
remDr <- remoteDriver(browserName = "firefox", port = 4455)
remDr$open()

我猜您的代码有什么问题:
我认为你是以错误的顺序运行命令。

您确实在端口4444上启动了Selenium Server(RSelenium::startServer()您的第3行 - 默认为port = 4444.) 然后尝试在端口4455(第6行)上运行远程驱动程序

remote.driver <- remoteDriver(remoteServerAddr = "localhost" , port = 4455, browserName = "firefox")

尝试在错误的端口上打开连接后,最终在端口4455(第7行)上启动服务器。