6

Because my previous question remained unsolved, I tried to specify the download directory using firefox instead of chrome.

So I specified the download directory:

fprof <- makeFirefoxProfile(list(browser.download.manager.showWhenStarting=FALSE,
                             browser.download.dir = "~/",
                             browser.helperApps.neverAsk.saveToDisk="text/csv",
                             browser.download.folderList = 2L))

remDr <- remoteDriver(extraCapabilities=fprof)

as exactly is done here.

However, the files still get downloaded in my default download directory, rather than my working directory in R.

Does anyone have a clue what I might be possibly doing wrong?

user3387899
  • 601
  • 5
  • 18

1 Answers1

5

This looks to be caused by the bug here. As a work around until it is fixed you could simply double escape everything, e.g.

library(tidyverse)
library(Rselenium)

file_path <- getwd() %>% str_replace_all("/", "\\\\\\\\")
fprof <- makeFirefoxProfile(list(browser.download.dir = file_path,
                                 browser.download.folderList = 2L,
                                 browser.download.manager.showWhenStarting = FALSE,
                                 browser.helperApps.neverAsk.openFile = "text/csv",
                                 browser.helperApps.neverAsk.saveToDisk = "text/csv")
                            )
Bryan Shalloway
  • 748
  • 7
  • 15
  • I've been trying to figure this out for hours! Many thanks! – StatsStudent Oct 20 '19 at 21:19
  • For me the strategy of replacing / by \\\\\\\\ did not work on Macintosh, I do not know if the bug has already been fixed as of July 2022. I simply specified `file_path <- getwd()`, the same `fprof`, and then set the driver as `rD<- rsDriver(browser = c("firefox"), extraCapabilities = fprof)` – Alberto Agudo Dominguez Jul 20 '22 at 15:32