chromote
chromote copied to clipboard
Can't start sesssion with chrome 141.0.7390.77 -- "Missing headless user data directory"
This is new behavior for me, discovered when trying to rebuild a README.Rmd file that has a snapshot of a DT::datatable().
The error message started me down the path of trying to specify a user data directory for debugging. When I do specify a user data directory I can get a snapshot.
Here's my minimal reprex
library(chromote)
library(withr)
docs_demo <- function(){
b <- ChromoteSession$new()
b$go_to("https://www.google.com")
b$screenshot()
b$close()
}
session_with_user_dir <- function(dir_path){
old_chrome_args <- get_chrome_args()
defer(set_chrome_args(old_chrome_args))
set_chrome_args(c(old_chrome_args, paste0("--user-data-dir=", dir_path)))
b <- ChromoteSession$new()
}
test_snap <- function(filename){
tmp_dir <- local_tempdir()
cli::cli_inform("Using temporary user data dir: {tmp_dir}")
b <- session_with_user_dir(tmp_dir)
b$go_to("https://www.google.com")
b$view()
b$screenshot(filename=filename)
b$close()
}
docs_demo()
#> Error in `with_random_port()`:
#> ! Cannot find an available port. Please try again.
#> Caused by error in `startup()`:
#> ! Failed to start chrome. Chrome is available on your system, so this error may be a configuration issue. Try `chromote_info()` to check and verify your settings.
#> Log file: C:/Users/XXXXXX/AppData/Local/Temp/RtmpeGl8Cf/chrome-59304c20795a-stderr.log
#> Error:
#> [1013/180756.988:ERROR:chrome\app\chrome_main.cc:207] Missing headless user data directory.
test_snap("~/snap1.png")
#> Using temporary user data dir:
#> C:\Users\XXXXXX\AppData\Local\Temp\RtmpeGl8Cf\file59303bfa793d
#> [1] TRUE
chromote_info()
#> ---- {chromote} ----
#> System: x86_64-w64-mingw32
#> R version: R version 4.5.1 (2025-06-13 ucrt)
#> chromote: 0.5.1
#>
#> ---- Chrome ----
#> Path: C:\Program Files\Google\Chrome\Application\chrome.exe
#> Version: 141.0.7390.77
#> Args: --headless --disable-gpu --force-color-profile=srgb
#> --disable-extensions --mute-audio
Created on 2025-10-13 with reprex v2.1.1