Specify download folder in RSelenium does not work

2019-07-10 07:52发布

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?

1条回答
爷、活的狠高调
2楼-- · 2019-07-10 08:24

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")
                            )
查看更多
登录 后发表回答