Latest version of RSelenium and Firefox

2019-07-10 03:15发布

问题:

When I try to open the RSelenium I receive this error

[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

The version of Firefox I have is

Firefox version: 480b10

According to this I tried to update the server version

library("RSelenium")
startServer()
unlink(system.file("bin", package = "RSelenium"), recursive = T)
checkForServer(update = TRUE)
remDr <- remoteDriver()
Sys.sleep(5)
remDr$open()
Sys.sleep(5)

but the problem still exist. Does anyone face this problem? Any possible solution?

回答1:

From Firefox 48 on-wards the gecko driver/ marionette will be needed to run Firefox with Selenium.

If you have Firefox 48 you can run the gecko driver as follows:

Refer to the guidelines

  1. https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
  2. Download the relevant gecko driver from https://github.com/mozilla/geckodriver/releases
  3. Add it to your PATH or refer to the location when starting binary (see below)
# get beta selenium standalone

RSelenium::checkForServer(beta = TRUE)
# assume gecko driver is not in our path (assume windows and we downloaded to docs folder)
# if the driver is in your PATH the javaargs call is not needed
selServ <- RSelenium::startServer(javaargs = c("-Dwebdriver.gecko.driver=\"C:/Users/john/Documents/geckodriver.exe\""))
remDr <- remoteDriver(extraCapabilities = list(marionette = TRUE))
remDr$open()
....
....
remDr$close()
selServ$stop()  

The above currently requires the dev version of RSelenium. Alternatively you can download the Selenium binary from http://selenium-release.storage.googleapis.com/index.html . Pick the 3.0 beta 2 binary to currently run with Firefox 48. Run the binary

java -Dwebdriver.gecko.driver=C:/Users/john/Documents/geckodriver.exe -jar selenium-server-standalone-3.0.0-beta2.jar