【问题标题】:RSelenium doesn't connectRSelenium 无法连接
【发布时间】:2016-08-06 02:01:00
【问题描述】:

我在尝试连接 RSelenium 包时遇到问题:

> checkForServer()
> startServer()
$stop
function () 
{
    tools::pskill(selPID)
}
<environment: 0x00000000039724d8>

$getPID
function () 
{
    return(selPID)
}
<environment: 0x00000000039724d8>

> remDr <- remoteDriver()
> 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.WebDriverException

我已经在我的计算机中配置了 Java,但 RSelenium 仍然失败。我已经阅读了这个网页上的很多帖子,但我仍然没有解决方案。我能做些什么?我的电脑是装有 Windows 10 Home Single 的华硕 X555LB。我附上会话信息:

    > sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=Spanish_Colombia.1252  LC_CTYPE=Spanish_Colombia.1252   
[3] LC_MONETARY=Spanish_Colombia.1252 LC_NUMERIC=C                     
[5] LC_TIME=Spanish_Colombia.1252    

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

other attached packages:
[1] rvest_0.3.2     xml2_1.0.0      RSelenium_1.4.0 XML_3.98-1.4    RJSONIO_1.3-0  
[6] RCurl_1.95-4.8  bitops_1.0-6    plyr_1.8.4      reshape_0.8.5  

loaded via a namespace (and not attached):
[1] httr_1.2.1     magrittr_1.5   R6_2.1.2       tools_3.3.0    Rcpp_0.12.6   
[6] caTools_1.17.1

感谢您的帮助。

更新:

library(seleniumPipes)
> remDr <- remoteDr()
Error detected:
Response status code : 500 
Selenium class exception: org.openqa.selenium.WebDriverException 
Selenium Status code:  13 
Selenium Status summary:  UnknownError 
Selenium Status detail:  An unknown server-side error occurred while processing the command. 
Selenium message:  Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: WIN10
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'DESKTOP-UPMNBBN', ip: '192.168.0.27', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_101'
Driver info: driver.version: FirefoxDriver 
Please check the response with errorResponse()
Please check the content returned with errorContent()
Error in checkResponse(res) : Selenium Server error

【问题讨论】:

  • 你运行的是什么版本的火狐?如果是 friefox 48 则需要下载 gecko 驱动见github.com/ropensci/RSelenium/issues/81
  • 我使用的是 firefox 46,但我正在避免升级它,因为 RSelenium 已在此版本上运行。
  • selenium server 的版本你改了吗?

标签: r selenium rselenium


【解决方案1】:

您能否安装seleniumPipes 并检查它可能给出的任何错误的输出:

devtools::install_github("johndharrison/seleniumPipes")
selServ <- RSelenium::startServer()
library(seleniumPipes)
remDr <- remoteDr()
remDr %>% go("http://www.google.com/ncr")
remDr %>% deleteSession()
selServ$stop()

更新:

seleniumPipes 的输出表明 selenium 驱动程序版本是 2.53.1。该消息还表明无法找到 firefox 二进制文件。您可以将 firefox 二进制路径作为参数提供给 JVM,使用 startServer(需要开发版本)。

selServ <- RSelenium::startServer(javaargs = c("-Dwebdriver.firefox.bin='C:\\YOURDIRPATH\\firefox.exe'"))

或者手动启动 selenium 二进制文件:

java -Dwebdriver.firefox.bin="C:\YOURDIRPATH\firefox.exe" -jar "selenium-server-standalone.jar"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-01-03
    • 2023-01-26
    • 2018-02-01
    • 2023-04-09
    • 1970-01-01
    • 1970-01-01
    • 2020-02-13
    • 1970-01-01
    相关资源
    最近更新 更多