Closed liori closed 4 years ago
It is possible, though one needs to manage the lifetime of the chromedriver process manually and set path=''
in the remoteDriver constructor invocation. For example:
chrome_driver_process <- processx::process$new(
'/usr/bin/chromedriver', '--verbose', stdout='chromedriver.log', stderr='2>&1')
chrome_log_file <- file('chromedriver.log')
while(T) {
line <- readLines(chrome_log_file, n=1)
if(length(line) > 0) break
Sys.sleep(0.01)
}
close(chrome_log_file)
extracted <- stringr::str_match(line, 'Starting ChromeDriver ([0-9.]+) on port ([0-9]+)')
version <- extracted[1, 2]
port <- as.numeric(extracted[1, 3])
remote_driver <- RSelenium::remoteDriver(port=port, path='', extraCapabilities=list(
chromeOptions=list(prefs=list(`download.default_directory`=getwd()))))
remote_driver$open()
(processx will automatically kill chromedriver when its process handle is garbage-collected).
Debian comes with both chromium and chromedriver that matches chromium's version as system packages. Is it possible to use them instead of possibly incompatible chromedriver downloaded from the network?