Below is the copied code for RSelenium::rsDriver()
written to a new function w/ just the name of the version
argument changed to version_sel
to prevent the duplicate name.
library(RSelenium)
rsDriver_edit <- function(port = 4567L, browser = c("chrome", "firefox", "phantomjs",
"internet explorer"), version_sel = "latest", chromever = "latest",
geckover = "latest", iedrver = NULL, phantomver = "2.1.1",
verbose = TRUE, check = TRUE, ...) {
browser <- match.arg(browser)
if (identical(browser, "internet explorer") && !identical(.Platform[["OS.type"]],
"windows")) {
stop("Internet Explorer is only available on Windows.")
}
selServ <- wdman::selenium(port = port, verbose = verbose,
version = version_sel, chromever = chromever, geckover = geckover,
iedrver = iedrver, phantomver = phantomver, check = check)
remDr <- remoteDriver(browserName = browser, port = port,
...)
count <- 0L
while (inherits(res <- tryCatch(remDr$getStatus(), error = function(e) e),
"error")) {
Sys.sleep(1)
count <- count + 1L
if (count > 5L) {
warning("Could not determine server status.")
break
}
}
res <- tryCatch(remDr$open(silent = !verbose), error = function(e) e)
if (inherits(res, "error")) {
message("Could not open ", browser, " browser.")
message("Client error message:\n", res$message)
message("Check server log for further details.")
}
csEnv <- new.env()
csEnv[["server"]] <- selServ
csEnv[["client"]] <- remDr
clean <- function(e) {
chk <- suppressMessages(tryCatch(e[["client"]]$close(),
error = function(e) e))
e[["server"]]$stop()
}
reg.finalizer(csEnv, clean)
class(csEnv) <- c("rsClientServer", class(csEnv))
return(csEnv)
}
My (vague) hope was that, then if I inputted a version
argument, this would be passed to ...
and into RSelenium::remote_driver()
.
However, as shown below, this does not work (note the "browserVersion" is "70.0.1" rather than the inputted version = "69.0"
).
rd <- rsDriver_edit(browser = "firefox", geckover = "0.25.0", version_sel = "3.141.5", version = "69.0")
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking chromedriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking geckodriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking phantomjs versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
[1] "Connecting to remote server"
$`acceptInsecureCerts`
[1] FALSE
$browserName
[1] "firefox"
$browserVersion
[1] "70.0.1"
$`moz:accessibilityChecks`
[1] FALSE
$`moz:buildID`
[1] "20191030021342"
$`moz:geckodriverVersion`
[1] "0.25.0"
$`moz:headless`
[1] FALSE
$`moz:processID`
[1] 1968
$`moz:profile`
[1] "C:\\Users\\BSHALLOW\\AppData\\Local\\Temp\\rust_mozprofilejpf0uk"
$`moz:shutdownTimeout`
[1] 60000
$`moz:useNonSpecCompliantPointerOrigin`
[1] FALSE
$`moz:webdriverClick`
[1] TRUE
$pageLoadStrategy
[1] "normal"
$platformName
[1] "windows"
$platformVersion
[1] "10.0"
$rotatable
[1] FALSE
$setWindowRect
[1] TRUE
$strictFileInteractability
[1] FALSE
$timeouts
$timeouts$`implicit`
[1] 0
$timeouts$pageLoad
[1] 300000
$timeouts$script
[1] 30000
$unhandledPromptBehavior
[1] "dismiss and notify"
$webdriver.remote.sessionid
[1] "cdb782c4-0508-4e7e-95ff-737237feb105"
$id
[1] "cdb782c4-0508-4e7e-95ff-737237feb105"