Specify download folder in RSelenium does not work

試著忘記壹切 提交于 2019-12-10 20:06:06

问题


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:


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")
                            )


来源:https://stackoverflow.com/questions/35551711/specify-download-folder-in-rselenium-does-not-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!