rstudio / chromote

Chrome Remote Interface for R
https://rstudio.github.io/chromote/
156 stars 20 forks source link

feat: Option/envvar to choose headless mode #172

Closed gadenbuie closed 2 months ago

gadenbuie commented 2 months ago

See background in #171 Fixes #149

This PR adds an internal chrome_headless_mode() function that consults the chromote.headless option or the CHROMOTE_HEADLESS environment variable (checked in that order). Allowed values are "old" and "new", the default is currently set to "old" to minimize disruption for chromote users.

Prior to this PR, users could not customize the --headless flag, meaning they could not opt into --headless=new before it became the default or opt out of it with --headless=old now that new is the default.

Choosing old as the default gives us some time to adjust to changes in Chrome upstream.

tatvabodhini commented 2 months ago

Right now I initiate the chrome session like this.. and I get the error 'Cannot find an available port. Please try again.'

chromote::set_default_chromote_object( chromote::Chromote$new(chromote::Chrome$new( args = c("--disable-gpu", "--no-sandbox", "--mute-audio", "--disable-timeouts-for-profiling", "--disable-dev-shm-usage", c("--force-color-profile", "srgb")) )) )

Is is suggested to add --headless=new ?? like below?

chromote::set_default_chromote_object( chromote::Chromote$new(chromote::Chrome$new( args = c("--disable-gpu", "--no-sandbox", "--mute-audio", "--disable-timeouts-for-profiling", "--disable-dev-shm-usage", c("--force-color-profile", "srgb"), c("--headless", "new") ) )) )