问题
I have a problem trying to connect with RSelenium package:
> 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
I already configured Java in my computer, but RSelenium still failing. And I has read many posts in this web page, but I still with no solution. What can I do? My computer is an ASUS X555LB with Windows 10 Home Single. I attach the session information:
> 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
I would appreciate your help.
Update:
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
回答1:
Can you install seleniumPipes
and check the output of any error it may give:
devtools::install_github("johndharrison/seleniumPipes")
selServ <- RSelenium::startServer()
library(seleniumPipes)
remDr <- remoteDr()
remDr %>% go("http://www.google.com/ncr")
remDr %>% deleteSession()
selServ$stop()
Update:
Your output from seleniumPipes
indicates that the selenium driver version is 2.53.1. The message also indicates the firefox binary cannot be located. You can give the firefox binary path as an argument to the JVM using
startServer (dev version required).
selServ <- RSelenium::startServer(javaargs = c("-Dwebdriver.firefox.bin='C:\\YOURDIRPATH\\firefox.exe'"))
alternatively start the selenium binary manually:
java -Dwebdriver.firefox.bin="C:\YOURDIRPATH\firefox.exe" -jar "selenium-server-standalone.jar"
来源:https://stackoverflow.com/questions/38799909/rselenium-doesnt-connect