4

I am trying to run RSelenium with the following code

(...)
eCaps  <- makeFirefoxProfile(list(browser.download.folderList = 2L,
                              browser.download.dir = gsub(x = getwd(), pattern =  "/", replacement =  "\\\\"),
                              browser.helperApps.neverAsk.saveToDisk = "text/plain,application/octet-stream,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                              browser.download.manager.showWhenStarting = FALSE))

remDr  <- rsDriver(browser = "firefox", extraCapabilities = eCaps)

client <- remDr$client
(...)

But then my script starts downloading files into the default location. Does anyone know why I can't override the default download folder setting? Thanks in advance.

Additional info:

Windows 10 64-bit

R version 3.5.0

RSelenium version 1.7.4

Firefox version 64.0b5 (I tried with a non-developer earlier version as well, same result)

  • 1
    See my note on post [56585364](https://stackoverflow.com/questions/35551711/specify-download-folder-in-rselenium-does-not-work/56585364#56585364). – Bryan Shalloway Jun 13 '19 at 17:01

1 Answers1

0

To set working directory as the download directory we can do,

file_path <- getwd() %>% str_replace_all("/", "\\\\\\")
eCaps <- list(
  chromeOptions =
    list(prefs = list('download.default_directory' = file_path))
)

driver <- rsDriver(browser = "chrome",port = 9635L, extraCapabilities = eCaps)
Nad Pat
  • 3,129
  • 3
  • 10
  • 20