I can get the following to work and the rest of my code functions as well:
library(RSelenium)
ecap <- list(chromeOptions = list(args = c('--headless', '--disable-gpu')))
rD <- rsDriver(browser = "chrome", geckover=NULL, iedrver=NULL, phantomver=NULL, extraCapabilities = ecap)
remDr <- rD[["client"]]
remDr$queryRD(ipAddr = paste0(remDr$serverURL, "/session/", remDr$sessionInfo[["id"]], "/chromium/send_command"),
method = "POST", qdata = list(cmd = "Page.setDownloadBehavior", params = list(behavior = "allow",
downloadPath = "D:/")))
I recently came across seleniumPipes which looks great to create a better overview of the rest of the code where you are driving a headless chrome. With the selenium pipes loaded I can open a headless chrome with:
library(RSelenium)
library(seleniumPipes)
rD <- rsDriver(browser = "chrome", port=4567L, geckover=NULL, iedrver=NULL, phantomver=NULL, extraCapabilities = ecap)
remDr <- remoteDr(browserName = "chrome", port=4567L, extraCapabilities = ecap)
And I can browse to websites. I would like to add the section:
remDr$queryRD(ipAddr = paste0(remDr$serverURL, "/session/", remDr$sessionInfo[["id"]], "/chromium/send_command"),
method = "POST", qdata = list(cmd = "Page.setDownloadBehavior", params = list(behavior = "allow",
downloadPath = "D:/")))
As this is required to actually download files using a headless chrome. However, seleniumPipes does not recognize remDr$queryRD nor remDr %>% queryRD. Does anyone know how to add this section so that it is recognized by seleniumPipes?