如何允许在 RSelenium 中直接下载多种文件类型(bzip2 和 csv)
How to allow multiple file types direct download (bzip2 and csv) in RSelenium
以下代码片段允许我们仅对 bzip2 文件执行直接下载:
require(RSelenium)
dirdownload <- "/path_to/my_output_dir"
fprof <- makeFirefoxProfile(list(browser.download.dir = dirdownload,
browser.download.folderList = 2,
browser.download.manager.showWhenStarting = FALSE,
browser.helperApps.neverAsk.saveToDisk = "application/x-bzip2"))
RSelenium::startServer()
remDr <- remoteDriver(extraCapabilities = fprof)
尤其是这一行:
browser.helperApps.neverAsk.saveToDisk = "application/x-bzip2"
如何允许 makeFirefoxProfile
包含 application/bzip2
和 text/csv
文件?
我试过了但失败了:
browser.helperApps.neverAsk.saveToDisk = c("application/x-bzip2", "text/csv")
应该这样做:
browser.helperApps.neverAsk.saveToDisk = "application/x-bzip2,text/csv,text/plain,application/json,application/zip"
它应该作为双引号内的逗号分隔列表工作
以下代码片段允许我们仅对 bzip2 文件执行直接下载:
require(RSelenium)
dirdownload <- "/path_to/my_output_dir"
fprof <- makeFirefoxProfile(list(browser.download.dir = dirdownload,
browser.download.folderList = 2,
browser.download.manager.showWhenStarting = FALSE,
browser.helperApps.neverAsk.saveToDisk = "application/x-bzip2"))
RSelenium::startServer()
remDr <- remoteDriver(extraCapabilities = fprof)
尤其是这一行:
browser.helperApps.neverAsk.saveToDisk = "application/x-bzip2"
如何允许 makeFirefoxProfile
包含 application/bzip2
和 text/csv
文件?
我试过了但失败了:
browser.helperApps.neverAsk.saveToDisk = c("application/x-bzip2", "text/csv")
应该这样做:
browser.helperApps.neverAsk.saveToDisk = "application/x-bzip2,text/csv,text/plain,application/json,application/zip"
它应该作为双引号内的逗号分隔列表工作