在发布此问题之前,我已搜索了其他一些问题Rselenium remDR$open() error, RSelenium connect attempt produces Java error, Rselenium remDR$open() error,但这些解决方案都不能解决我的问题。由于我没有足够的声誉在他们的解决方案下添加评论,所以我必须发布一个新的。请原谅我,如果我在第一次冒充时做了一些傻瓜。谢谢。 (我也在帖子https://github.com/ropensci/RSelenium/issues/42下报告了这个问题,但仍然没有得到答案,对不起我的匆忙)
我即将运行的代码:
library(RSelenium)
unlink(system.file("bin", package = "RSelenium"), recursive = T)
checkForServer()
startServer()
remDr <- remoteDriver(browserName = "firefox")
remDr$open()
有两种不同的环境:
Ubuntu 14.04.3 LTS,
Mozilla Firefox 42.0,java version "1.8.0_66",
R version 3.2.2 (2015-08-14) -- "Fire Safety",
RSelenium 2.48.0"
OS X EI Captian version 10.11.1,
Mozilla Firefox 42.0,
java version "1.8.0_66",
R version 3.2.2 (2015-08-14) -- "Fire Safety",
RSelenium 2.48.0"
我在Ubuntu上运行代码时经常遇到同样的错误,但是,如果我在Mac上运行相同的代码,一切正常。你能帮助我吗?详情如下。
在Ubuntu上,
> library(RSelenium)
Loading required package: RCurl
Loading required package: bitops
Loading required package: RJSONIO
Loading required package: XML
> unlink(system.file("bin", package = "RSelenium"), recursive = T)
> checkForServer()
[1] "DOWNLOADING STANDALONE SELENIUM SERVER. THIS MAY TAKE SEVERAL MINUTES"
trying URL 'http://selenium-release.storage.googleapis.com/2.48/selenium-server-standalone-2.48.0.jar'
Content type 'application/java-archive' length 30782545 bytes (29.4 MB)
==================================================
downloaded 29.4 MB
> startServer()
> remDr <- remoteDriver(browserName = "firefox")
> remDr$open()
[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
$build$version
[1] "2.48.0"
$build$revision
[1] "b7b081a"
$build$time
[1] "2015-10-07 15:48:56"
$os
$os$name
[1] "Linux"
$os$arch
[1] "amd64"
$os$version
[1] "3.13.0-48-generic"
$java
$java$version
[1] "1.8.0_66"
当我在Mac上运行时
> library(RSelenium)
Loading required package: RCurl
Loading required package: bitops
Loading required package: RJSONIO
Loading required package: XML
> startServer()
> remDr <- remoteDriver(browserName = "firefox")
>
> remDr$open()
[1] "Connecting to remote server"
$applicationCacheEnabled
[1] TRUE
$rotatable
[1] FALSE
$handlesAlerts
[1] TRUE
$databaseEnabled
[1] TRUE
$version
[1] "42.0"
$platform
[1] "MAC"
$nativeEvents
[1] FALSE
$acceptSslCerts
[1] TRUE
$webdriver.remote.sessionid
[1] "a7196eee-b75b-46c2-bdb3-97933aa88c06"
$webStorageEnabled
[1] TRUE
$locationContextEnabled
[1] TRUE
$browserName
[1] "firefox"
$takesScreenshot
[1] TRUE
$javascriptEnabled
[1] TRUE
$cssSelectorsEnabled
[1] TRUE
$id
[1] "a7196eee-b75b-46c2-bdb3-97933aa88c06"
> remDr$getStatus()
$build
$build$version
[1] "2.48.0"
$build$revision
[1] "b7b081a"
$build$time
[1] "2015-10-07 15:48:56"
$os
$os$name
[1] "Mac OS X"
$os$arch
[1] "x86_64"
$os$version
[1] "10.11.1"
$java
$java$version
[1] "1.8.0_65"
在Mac上
R
R version 3.2.2 (2015-08-14) -- "Fire Safety"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.0.0 (64-bit)
我的盲目猜测:这可能不是版本问题,否则,它无法在Mac上运行良好,Firefox和RSelenium的版本都是最新版本。