2016-08-06 47 views
0

我試圖用RSelenium封裝連接了一個問題: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 
+0

您運行的是什麼版本的Firefox?如果是friefox 48,則需要下載gecko驅動程序,請參閱https://github.com/ropensci/RSelenium/issues/81 – jdharrison

+0

我使用的是Firefox 46,我正在避免升級它,因爲RSelenium已與此版本一起運行。 – fcochaux

+0

您是否更改硒服務器的版本? – jdharrison

回答

0

可以在安裝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你的輸出表明硒司機版本是2.53.1。該消息還表示無法找到Firefox二進制文件。您可以使用 startServer(需要開發版本)將firefox二進制路徑作爲JVM的參數。

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

或者手動啓動硒二進制:

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