Reputation: 5281
I am using RSelenium
via docker
and the standalone-firefox
image v 3.11.0
. Also, I am using R v 3.4.4
on Windows 10 (64-bit)
.
I am facing a peculiar issue, happening arbitrarily it seems. Here is my code:
# In the Docker Terminal
$ docker run -d -p 4445:4444 selenium/standalone-firefox:3.11.0
# In R
require(RSelenium)
require(XML)
remDr <- RSelenium::remoteDriver(remoteServerAddr = "192.168.99.100", port = 4445L)
remDr$open()
remDr$navigate("https://www.betvictor.com/")
Sys.sleep(1)
remDr$screenshot(display = TRUE)
Yielding the following error:
Selenium message:Failed to decode response from marionette
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:15.31Z'
System info: host: '29208ebb0e68', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.89-boot2docker', java.version: '1.8.0_162'
Driver info: driver.version: unknown
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: org.openqa.selenium.WebDriverException
Further Details: run errorDetails method
I did some research on the topic:
2.53.0
, or using Chrome should solve the issue.However, I tried using standalone-chrome:3.11.0
but remDr$open()
then yields Selenium message:Unable to create new service: GeckoDriverService
.
And as for 2., to quote the (RSelenium
) documentation: "[The package] Provides a set of R bindings for the Selenium 2.0 WebDriver", which might explain why that error arose in the first place.
Is there a way to solve that issue, e.g. is it possible to update the RSelenium
package such that it uses a more recent version of Selenium
?
Upvotes: 1
Views: 399
Reputation: 11
This code works for me:
library(RSelenium)
library(png)
library(openssl)
Sys.setenv(no_proxy="127.0.0.1,localhost,192.168.0.20")
extraCapabilities <- list(proxy = list(httpProxy = "proxy-server:8081",
proxyType = "MANUAL",
sslProxy = "proxy-server:8081"),
acceptInsecureCerts = TRUE)
remDr <- remoteDriver(remoteServerAddr = "selenium.server.de"
, port = 4444
, browserName = "firefox"
, extraCapabilities = extraCapabilities)
remDr$open()
remDr$navigate("http://google.com")
remDr$screenshot(file = '/tmp/test.png')
res <- remDr$getStatus()
remDr$close()
My Docker-Selenium is behind a company proxy. This part in the extraCapabilities is not necessary for a normal use case. The environment variable no_proxy is also only necessary if you are working behind a proxy. The parameter "acceptInsecureCerts = TRUE" is important, otherwise problems will occur with newer Firefox versions. The command "makeFirexprofile" didn't work for me anymore. This is often found in the instructions for using proxies. It didn't work out that way. The error messages of RSelenium are also not useful. It makes more sense to raise the log level on the docker container. This works with -e JAVA_OPTS="-Dselenium.LOGGER.level=ALL". This shows the real error that has occurred.
I hope that helps. I was successful with the container firefox-standalone:3.12.
Upvotes: 1